Method and storage medium for sentiment classification of bullet screen text based on semi-supervised deep learning

By adopting a semi-supervised deep learning method in barrage sentiment analysis, and using augmented barrage sample collection and attention mechanism model, the problems of inaccurate marking and narrow application scope in the existing technology are solved, and a more accurate and extensive barrage sentiment classification is achieved.

CN116304009BActive Publication Date: 2025-06-24HEFEI UNIV OF TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211458739.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-11-17
Publication Date
2025-06-24
Estimated Expiration
2042-11-17

AI Technical Summary

Technical Problem

The prior art has problems in barrage sentiment analysis, which are not accurate enough and narrow in scope of application. In particular, the methods based on emotion dictionary fail to consider the semantic sequence nature of words, while machine learning-based methods require a large amount of manual labeling of information and are difficult to utilize unlabeled data.

Method used

Using a semi-supervised deep learning method, the barrage text is randomly labeled, word vectors are obtained, and augmented barrage sample collection is constructed. The word-level GRU bidirectional gating cycle model and sentence-level attention mechanism model are used to extract features to realize emotional classification.

Benefits of technology

It improves the accuracy of barrage emotional marking, expands the scope of application, can effectively utilize unlabeled data, reduces the workload of manual labeling, and improves the ability to identify a few samples.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116304009B_ABST
    Figure CN116304009B_ABST
Patent Text Reader

Abstract

An embodiment of the present invention provides a method and a storage medium for sentiment classification of barrage text based on semi-supervised deep learning, belonging to the technical field of barrage sentiment classification. The method for sentiment classification of barrage text includes randomly assigning sentiment labels to all barrage texts; obtaining word vectors of all barrage texts; obtaining a single barrage text labeled with a sentiment label at the t-th time step and M barrage texts before and after the barrage text, and forming an augmented barrage sample set. The present invention can reduce the workload of labels during pre-training by randomly labeling barrage texts and constructing an augmented barrage sample set; in addition, by using a word-level attention mechanism model and a sentence-level attention mechanism model, the mutual influence relationship between the words inside the barrage and between adjacent barrages can be obtained and fused, so as to make the sentiment classification of barrage text more accurate and reliable.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of bullet screen emotion classification, and specifically relates to a method and storage medium for bullet screen text emotion classification based on semi-supervised deep learning. Background Art

[0002] With the continuous progress of social and economic development and Internet information technology, video programs, short videos, webcasts, etc. have become the ways for many people to study and entertain, and video platforms are becoming more and more popular among the public. Subsequently, as a new video comment mechanism, bullet screens have become a unique cultural practice for audiences to express their views on movies and TV dramas, live broadcasts, and variety shows in online videos. When watching online videos, viewers can publish their views on the video content in real time through bullet screens, and can also see the feelings expressed by other viewers at the same time, and communicate with users in the form of bullet screens. Therefore, bullet screens always contain the evaluations and emotional attitudes expressed by users on video content, which provides a new perspective for video content quality management. Video publishers or platform supervisors can judge user satisfaction and video quality by analyzing the emotional tendency of bullet screens, providing a theoretical basis for future video management.

[0003] Currently, the existing methods in the field of bullet screen emotion analysis include the bullet screen emotion analysis method based on an emotion dictionary: an emotion dictionary containing positive, neutral, and negative emotion words is constructed according to the characteristics of the field, and the emotional tendency of the bullet screen is judged by matching the corresponding emotion words. The method based on the emotion dictionary only analyzes emotion words and does not consider the semantic sequence of words within and between bullet screens, which makes it easy to misjudge the emotional tendency of bullet screens in practical applications. There is also a bullet screen emotion analysis method based on machine learning: first, the text is converted into vector numbers that can be recognized by a machine, and then an algorithm model is designed to extract the emotional features of the bullet screen text and learn the mapping relationship between the input and output of the learning system. The method based on machine learning requires a large amount of bullet screen emotion annotation information. Currently, the acquisition of these annotation information usually relies on manual annotation, which consumes a lot of manpower and financial resources. And the existing machine learning methods are difficult to utilize unlabeled data, which greatly limits the application scope of machine learning methods in bullet screen emotion analysis.

[0004] The inventors of the present application found in the process of implementing the present invention that the above-mentioned solutions of the prior art have the defects of inaccurate bullet screen emotion marking and narrow application scope. Summary of the Invention

[0005] The purpose of the embodiments of the present invention is to provide a method and storage medium for bullet screen text emotion classification based on semi-supervised deep learning. The method and storage medium for bullet screen text emotion classification based on semi-supervised deep learning can accurately mark the emotions of bullet screens and have a wide application scope.

[0006] To achieve the above object, on the one hand, an embodiment of the present invention provides a method for sentiment classification of bullet screen text based on semi-supervised deep learning, including:

[0007] Randomly assign sentiment labels to all bullet screen texts;

[0008] Obtain the word vectors of all bullet screen texts;

[0009] Obtain the single bullet screen text with a sentiment label at the t-th time step and M bullet screen texts before and after the bullet screen text, and form an augmented bullet screen sample set;

[0010] Input the augmented bullet screen sample set into a word-level GRU bidirectional gated recurrent model to obtain the word-level information of each bullet screen text in the augmented bullet screen sample set, and form a word-level information set;

[0011] Input the word-level information set into a word-level attention mechanism model to obtain the sentence feature vectors of each bullet screen text in the word-level information set, and form a sentence feature vector set;

[0012] Input the sentence feature vector set into a sentence-level GRU bidirectional gated recurrent model to obtain the sentence-level information of each bullet screen text in the word-level feature vector set, and form a sentence-level information set;

[0013] Input the sentence-level information set into a sentence-level attention mechanism model to obtain an augmented sample feature vector;

[0014] Obtain the sentiment attitude category vector of the single bullet screen text with a sentiment label at the t-th time step according to the augmented sample feature vector;

[0015] Output the sentiment category according to the sentiment attitude category vector.

[0016] Optionally, obtaining the word vectors of all bullet screen texts includes:

[0017] Calculate the word vectors of all bullet screen texts according to formula (1),

[0018] h s = W s h · x i ,

[0019] x i = softmax(W s o · h s ), (1)

[0020] where h s is the output of the hidden layer, W sh is the mapping weight from the input layer to the hidden layer, x i is the encoding matrix of the i-th bullet screen text, x i is the word vector of the i-th bullet screen text, where i is an integer number,

[0021] softmax() is the Softmax function, W s o is the mapping weight from the hidden layer to the output layer;

[0022] Calculate the objective function of the word vector according to formula (2),

[0023] L s = -logp0(w s0,1 , w s0,2 , …, w s0,C |w sI ), (2)

[0024] where, L s is the objective function value, w s0,c is the word vector of the C-th context word, where C is a positive integer number, p0 is the conditional probability, w sI is the middlemost word vector.

[0025] Optionally, input the augmented bullet screen sample set into the word-level GRU bidirectional gated recurrent model to obtain the word-level information of each bullet screen text in the augmented bullet screen sample set, and form a word-level information set including:

[0026] Calculate the size of the update gate in the word-level GRU bidirectional gated recurrent model according to formula (3),

[0027] z t = σ(U z1 x t+m + W z1 h t-1 + b z1 ), (3)

[0028] where, z t is the size of the update gate in the word-level GRU bidirectional gated recurrent model, σ() is the Sigmoid function, U z1 is the input transformation matrix of the update gate in the word-level GRU bidirectional gated recurrent model, W z1 is the hidden transformation matrix of the update gate in the word-level GRU bidirectional gated recurrent model, b z1 is the bias of the update gate in the word-level GRU bidirectional gated recurrent model, h t-1 is the hidden state of the previous word-level information in the word-level GRU bidirectional gated recurrent model, xt+m is the word vector of the last m bullet screen texts at the t-th time step of the augmented bullet screen sample set, where m is an integer number, and -M ≤ m ≤ M, and M is a positive integer;

[0029] Calculate the size of the reset gate in the word-level GRU bidirectional gated recurrent model according to formula (4).

[0030] r t = σ(U r1 x t+m + W r1 h t-1 + b r1 ), (4)

[0031] where r t is the size of the reset gate in the word-level GRU bidirectional gated recurrent model, U r1 is the input transformation matrix of the reset gate in the word-level GRU bidirectional gated recurrent model, W r1 is the hidden transformation matrix of the reset gate in the word-level GRU bidirectional gated recurrent model, b r1 is the bias of the reset gate in the word-level GRU bidirectional gated recurrent model;

[0032] Calculate the newly generated memory information in the word-level GRU bidirectional gated recurrent model according to formula (5).

[0033] s t = tanh(U s1 x t+m + W s1 r t × h t-1 + b s1 ), (5)

[0034] where s t is the newly generated memory information in the word-level GRU bidirectional gated recurrent model, U s1 is the input transformation matrix of the newly generated memory information in the word-level GRU bidirectional gated recurrent model, W s1 is the hidden transformation matrix of the newly generated memory information in the word-level GRU bidirectional gated recurrent model, b s1 is the bias of the newly generated memory information in the word-level GRU bidirectional gated recurrent model, and tanh() is the activation function;

[0035] Calculate the updated hidden state value in the word-level GRU bidirectional gated recurrent model according to formula (6).

[0036] h t = (1 - z t ) × h t-1 + zt ×s t , (6)

[0037] Among them, h t is the updated hidden state value in the word-level GRU bidirectional gated recurrent model;

[0038] Calculate the word-level information of each bullet screen text in the augmented bullet screen sample set according to formula (7),

[0039]

[0040] Among them, w t+m is the word-level information of the last m bullet screen texts at the t-th time step in the augmented bullet screen sample set, is the forward hidden state value, is the backward hidden state value.

[0041] Optionally, input the word-level information set into the word-level attention mechanism model to obtain the sentence feature vector of each bullet screen text in the word-level information set and form a sentence feature vector set; including:

[0042] Calculate the weight vector of the word-level attention mechanism model according to formula (8),

[0043]

[0044] Among them, Ω h is the weight vector of the word-level attention mechanism model, is the K value obtained from the word-level information of the last m bullet screen texts at the t-th time step, is the Q value obtained from the word-level information of the last m bullet screen texts at the t-th time step, is the linear mapping matrix of the Q value of the h-th head in the word-level attention mechanism model, is the linear mapping matrix of the K value of the h-th head in the word-level attention mechanism model, T represents matrix transpose, d w is the dimension of the input word vector;

[0045] Calculate the vector to be output of the word-level attention mechanism model according to formula (9),

[0046]

[0047] Among them, wsa h is the vector to be output of the word-level attention mechanism model, is the linear mapping matrix of the V value of the h-th head in the word-level attention mechanism model, The V value obtained for the word-level information of the last m bullet screen texts at the t-th time step;

[0048] Calculate the sentence feature vector of each bullet screen text in the word-level information set according to formula (10),

[0049] W t+m = Concat(wsa1, …, wsa H ), (10)

[0050] where W t+m is the sentence feature vector of the last m bullet screen texts at the t-th time step in the word-level information set.

[0051] Optionally, input the sentence feature vector set into a sentence-level GRU bidirectional gated recurrent model to obtain the sentence-level information of each bullet screen text in the sentence feature vector set, and form a sentence-level information set including:

[0052] Calculate the size of the update gate in the sentence-level GRU bidirectional gated recurrent model according to formula (11),

[0053] Z t = σ(U z2 W t+m + W z2 H t-1 + b z2 ), (11)

[0054] where Z t is the size of the update gate in the sentence-level GRU bidirectional gated recurrent model, U z2 is the input transformation matrix of the update gate in the sentence-level GRU bidirectional gated recurrent model, W z2 is the hidden transformation matrix of the update gate in the sentence-level GRU bidirectional gated recurrent model, b z2 is the bias of the update gate in the sentence-level GRU bidirectional gated recurrent model, and H t-1 is the hidden state of the previous sentence-level information in the sentence-level GRU bidirectional gated recurrent model;

[0055] Calculate the size of the reset gate in the sentence-level GRU bidirectional gated recurrent model according to formula (12),

[0056] R t = σ(U r2 W t+m + W r2 h t-1 + b r2 ), (12)

[0057] where R tis the size of the reset gate in the sentence-level GRU bidirectional gated recurrent model, U r2 is the input transformation matrix of the reset gate in the sentence-level GRU bidirectional gated recurrent model, W r2 is the hidden transformation matrix of the reset gate in the sentence-level GRU bidirectional gated recurrent model, b r2 is the bias of the reset gate in the sentence-level GRU bidirectional gated recurrent model;

[0058] Calculate the newly generated memory information in the sentence-level GRU bidirectional gated recurrent model according to formula (13),

[0059] S t = tanh(U s2 W t+m + W s2 R t × H t-1 + b s2 ), (13)

[0060] where S t is the newly generated memory information in the sentence-level GRU bidirectional gated recurrent model, U s2 is the input change matrix of the newly generated memory information in the sentence-level GRU bidirectional gated recurrent model, W s2 is the hidden transformation matrix of the newly generated memory information in the sentence-level GRU bidirectional gated recurrent model, b s2 is the bias of the newly generated memory information in the sentence-level GRU bidirectional gated recurrent model;

[0061] Calculate the updated hidden state value in the sentence-level GRU bidirectional gated recurrent model according to formula (14),

[0062] H t = (1 - Z t ) × H t-1 + Z t × S t , (14)

[0063] where H t is the updated hidden state value in the sentence-level GRU bidirectional gated recurrent model;

[0064] Calculate the sentence-level information of each bullet screen text in the sentence feature vector set according to formula (15),

[0065]

[0066] where P t+m is the sentence-level signal of the bullet screen text at the (t + m)-th time step in the sentence feature vector set, is the forward hidden state value, is the backward hidden state value.

[0067] Optionally, input the sentence-level information set into the sentence-level attention mechanism model to obtain an augmented sample feature vector, including:

[0068] Calculate the weight vector of the sentence-level attention mechanism model according to formula (16),

[0069]

[0070] where K h is the weight vector of the sentence-level attention mechanism model, is the value of K obtained from the sentence-level information of the bullet screen text at the (t + m)-th time step, is the value of Q obtained from the sentence-level information of the bullet screen text at the (t + m)-th time step, is the linear mapping weight of the Q value of the h-th head of the sentence-level attention mechanism model, is the linear mapping weight of the K value of the h-th head of the sentence-level attention mechanism model, T represents matrix transpose, d p is the dimension of the input sentence vector;

[0071] Calculate the vector to be output by the sentence-level attention mechanism model according to formula (17),

[0072]

[0073] where csa h is the vector to be output by the sentence-level attention mechanism model, is the value of V obtained from the sentence-level information of the bullet screen text at the (t + m)-th time step, is the linear mapping weight of the V value of the h-th head of the sentence-level attention mechanism model;

[0074] Calculate the augmented sample feature vector according to formula (18),

[0075] L = Concat(csa1, …, csa H ), (18)

[0076] where L is the augmented sample feature vector.

[0077] Optionally, obtain the sentiment attitude category vector of the single bullet screen text labeled with sentiment at the t-th time step according to the augmented sample feature vector, including:

[0078] Calculate the sentiment attitude category vector according to formula (19),

[0079] E = Softmax(w E L + b E ), (19)

[0080] where E represents the emotional attitude category vector, w E represents the linear mapping matrix, and b E represents the bias.

[0081] Optionally, the bullet screen text emotion classification method further includes:

[0082] Calculating the objective function of the entire model according to formula (20),

[0083] USL = -(1 - p t ) χ log(1 - p t ),

[0084]

[0085] where USL is the objective function, p is the probability that the emotion category is the positive category, p t is the probability of the emotion category, χ is a manually set adjustment factor parameter, which is a non - negative number, y is the emotion category, y = 1 is the positive category, and y = - 1 is the negative category.

[0086] Optionally, outputting the emotion category according to the emotional attitude category vector includes:

[0087] Judging whether the positive category in the emotional attitude category vector is greater than or equal to the negative category in the emotional attitude category vector;

[0088] When it is judged that the positive category in the emotional attitude category vector is greater than or equal to the negative category in the emotional attitude category vector, output the positive category label;

[0089] When it is judged that the positive category in the emotional attitude category vector is less than the negative category in the emotional attitude category vector, output the negative category label.

[0090] On the other hand, the present invention also provides a computer - readable storage medium, and the computer - readable storage medium stores instructions, and the instructions are used to be read by a machine so that the machine executes any one of the above - mentioned bullet screen text emotion classification methods.

[0091] Through the above technical solution, the method and storage medium for sentiment classification of barrage text based on semi-supervised deep learning provided by the present invention calculate the word vectors of all barrage texts and randomly label some barrage texts, obtain the barrage texts before and after the labeled barrage, and form an augmented barrage sample set. Then, according to this augmented barrage sample set, the sentiment attitude category value of the labeled barrage is calculated, and the accurate recognition of the sentiment classification of the barrage text can be realized. The present invention adopts the method of randomly labeling barrage texts and constructing an augmented barrage sample set, which can reduce the workload of labels during pre-training. In addition, the word-level attention mechanism model and the sentence-level attention mechanism model are adopted to obtain the mutual influence relationship between the words inside the barrage and between adjacent barrages and fuse them, so as to make the sentiment classification of the barrage text more accurate and reliable.

[0092] Other features and advantages of the embodiments of the present invention will be described in detail in the subsequent specific implementation part. BRIEF DESCRIPTION OF THE DRAWINGS

[0093] The drawings are used to provide a further understanding of the embodiments of the present invention, and constitute a part of the specification. Together with the following specific implementation, they are used to explain the embodiments of the present invention, but do not constitute a limitation to the embodiments of the present invention. In the drawings:

[0094] Figure 1 is a flowchart of a method for sentiment classification of barrage text based on semi-supervised deep learning according to an embodiment of the present invention;

[0095] Figure 2 is a flowchart of obtaining word vectors in the method for sentiment classification of barrage text based on semi-supervised deep learning according to an embodiment of the present invention;

[0096] Figure 3 is a flowchart of obtaining word-level information in the method for sentiment classification of barrage text based on semi-supervised deep learning according to an embodiment of the present invention;

[0097] Figure 4 is a flowchart of obtaining sentence feature vectors in the method for sentiment classification of barrage text based on semi-supervised deep learning according to an embodiment of the present invention;

[0098] Figure 5 is a flowchart of obtaining sentence-level information in the method for sentiment classification of barrage text based on semi-supervised deep learning according to an embodiment of the present invention;

[0099] Figure 6 is a flowchart of obtaining augmented sample feature vectors in the method for sentiment classification of barrage text based on semi-supervised deep learning according to an embodiment of the present invention;

[0100] Figure 7It is a flowchart for obtaining emotion categories in the bullet screen text emotion classification method based on semi-supervised deep learning according to an embodiment of the present invention. Detailed implementation manners

[0101] The following will describe in detail the specific implementation manners of the embodiments of the present invention with reference to the accompanying drawings. It should be understood that the specific implementation manners described herein are only used to illustrate and explain the embodiments of the present invention, and are not used to limit the embodiments of the present invention.

[0102] Figure 1 It is a flowchart of the bullet screen text emotion classification method based on semi-supervised deep learning according to an embodiment of the present invention. In Figure 1 it, the bullet screen text emotion classification method may include:

[0103] In step S10, emotional labels are randomly assigned to all bullet screen texts. Among them, the bullet screen information of the video website, including bullet screen text information, bullet screen appearance time and other information, can be obtained through web crawlers and stored as a csv file. Then, text preprocessing is performed on the bullet screen text to remove invalid bullet screens. In addition, in order to obtain data for pre-training and verification of the model, random emotional labels also need to be assigned to some bullet screen texts. Specifically, in order to improve the accuracy and effectiveness of model pre-training, the labels of the pre-training data can be as evenly and equally spaced as possible. Specifically, the text preprocessing and emotional labeling of the bullet screen text may include using the jieba library for text preprocessing, mainly including two steps of word segmentation and stop word removal. In the specific implementation process, on the basis of the jieba built-in word library, combined with the characteristics of the bullet screen, a user-defined dictionary can be added to improve the accuracy of word segmentation.

[0104] In step S11, word vectors of all bullet screen texts are obtained. Among them, the words in the bullet screen text are often related to the context words, so it is crucial to capture the context semantics in the words used in each bullet screen text. The present invention uses the Word2vec model to learn the context association relationship of the words in each bullet screen, generates word vectors for each word in the text, and then combines the word vectors according to the bullet screen text to obtain the final sentence vector. The Word2vec model has two training methods: CBOW and Skip-gram. The present invention chooses to use the Skip-gram model, with a certain word as the input to predict the context words around it. Skip-gram can be regarded as a lightweight network with only one hidden layer, and its input is the One-hot encoding of the known word.

[0105] In step S12, obtain a single bullet screen text labeled with an emotion at the t-th time step and M bullet screen texts before and after the bullet screen text, and form an augmented bullet screen sample set. Among them, for each bullet screen text with an emotion label, use M bullet screen texts before and after it in terms of appearance time to form the augmented bullet screen sample set, where M is a positive integer. For example, [x t ,y t , x t represents a single bullet screen text labeled with an emotion at the t-th time step, and y t is the emotion label of this bullet screen text. Then the corresponding augmented bullet screen sample set should be [x t-M ,x t-M+1 ,…,x t ,…,x t+M-1 ,x t+M ; y t , and it is also a semi-supervised sample. That is, the input data is composed of the self-vector of a single bullet screen text labeled with an emotion at the t-th time step and the word vectors of M bullet screen texts before and after it, and the emotion label is still the emotion label of the single bullet screen text labeled with an emotion at the t-th time step. Furthermore, for the prediction of each bullet screen sample, 2M unlabeled bullet screen texts can be used for auxiliary prediction. In addition, when randomly assigning emotion labels to all bullet screen texts, the emotion label can also be assigned once every M bullet screen texts. On the one hand, it can greatly reduce the workload of emotion labeling and fully exploit the information in the unlabeled bullet screen texts; on the other hand, it can also make full use of the unlabeled information, which can, to a certain extent, alleviate the problem of insufficient data of a small number of samples and is conducive to better learning the data characteristics of a small number of samples, so as to better identify a small number of samples.

[0106] In step S13, the augmented barrage sample set is input into the word-level GRU bidirectional gated recurrent model to obtain the word-level information of each barrage text in the augmented barrage sample set and form a word-level information set. Among them, like other types of texts, barrage texts have sequentiality. Therefore, in order to capture the sequential features of barrage texts, after the augmented barrage sample set is constructed, each barrage sample in the augmented barrage sample set is input into the word-level GRU bidirectional gated recurrent model, that is, 2M + 1 word-level GRU bidirectional gated recurrent models, to extract the word-level information of each barrage text and train the model. Finally, the word-level information of each barrage text is summarized to form a word-level information set. The GRU bidirectional gated recurrent model is an improved version of the original recurrent neural network (RNN). By introducing a gating mechanism, it makes up for the defects of gradient disappearance and gradient explosion existing in the original recurrent neural network (RNN). The units in the GRU bidirectional gated recurrent model are connected in sequence according to time, will connect to the output of the network at the previous moment and store the features at the previous moment in memory, and a memory unit stores the network output at this moment, so it has circularity. In addition, the GRU bidirectional gated recurrent model controls the selective transmission of information by adding an update gate and a reset gate, realizing long-term memory of information.

[0107] In step S14, the word-level information set is input into the word-level attention mechanism model to obtain the sentence feature vector of each barrage text in the word-level information set and form a sentence feature vector set. Among them, after obtaining the word-level information set, the word-level information of each barrage text in the word-level information set is input into the word-level attention mechanism model, and the word-level attention mechanism model fuses the multiple word-level information in each barrage text to obtain the sentence feature vector of this barrage text. Finally, the sentence-level information of each barrage text is summarized to form a sentence feature vector set. For barrage sentiment analysis, the state representation of each word will affect the sentiment expression of the whole sentence. However, a large amount of useful historical information will be lost during the calculation process of the GRU bidirectional gated recurrent model. Therefore, the present invention uses the word-level attention mechanism model to fuse the multiple word-level information of each barrage text to obtain the sentence feature vector of each barrage text.

[0108] In step S15, the sentence feature vector set is input into the sentence-level GRU bidirectional gated recurrent model to obtain the sentence-level information of each barrage text in the word-level feature vector set and form a sentence-level information set. Among them, in order to extract the dynamic features between each barrage text and identify the context information of adjacent barrage texts, the sentence feature vector of each barrage text in the sentence feature vector set needs to be input into the sentence-level GRU bidirectional gated recurrent model to obtain the sentence-level information, and finally summarized into a sentence-level information set.

[0109] In step S16, the sentence-level information set is input into the sentence-level attention mechanism model to obtain an augmented sample feature vector. In order to measure the importance of each bullet comment, the sentence-level information set needs to be input into the sentence-level attention mechanism model to fuse the feature vectors of multiple bullet comment texts and form an augmented sample feature vector.

[0110] In step S17, the emotion attitude category vector of the single bullet text with emotion label at the tth time step is obtained according to the augmented sample feature vector. After the augmented sample feature vector is obtained, it is converted into an emotion attitude category vector to facilitate the subsequent acquisition of the emotion category of the bullet text.

[0111] In step S18, the emotion category is output according to the emotion attitude category vector. In this embodiment of the present invention, the emotion category is divided into two types: positive category and negative category.

[0112] In step S10 to step S18, all barrage texts are randomly sentimentally labeled in advance, and word vectors of all barrage texts are obtained. Then all barrage texts with sentiment labels are aggregated with the M barrage texts before and after them, and multiple augmented barrage sample sets are formed, and divided into training data and verification data in proportion. Then the multiple augmented barrage sample sets are sequentially input into the word-level GRU bidirectional gated recurrent model, the word-level attention mechanism model, the sentence-level GRU bidirectional gated recurrent model, and the sentence-level attention mechanism model, and the augmented sample feature vector is obtained. Finally, the emotion category is obtained according to the augmented sample feature vector, and the model in this emotion classification method is trained according to the known training data and verification data.

[0113] Traditional bullet screen sentiment analysis methods include the bullet screen sentiment analysis method based on sentiment dictionaries. A sentiment dictionary containing positive, neutral, and negative sentiment words is constructed according to the characteristics of the field, and the sentiment tendency of the bullet screen is judged by matching the corresponding sentiment words. However, this method does not consider the semantic sequence of words within and between bullet screens, which makes it easy to misjudge the sentiment tendency of bullet screens in actual applications. In addition, there is also a bullet screen sentiment analysis method based on machine learning: the text is converted into vector numbers that can be recognized by machines, and then the sentiment features of the bullet screen text are extracted by designing an algorithm model to learn the mapping relationship between the input and output of the learning system. However, this method requires a large amount of bullet screen sentiment annotation information. Currently, the acquisition of these annotation information usually relies on manual annotation, which consumes a lot of manpower and financial resources. And the existing machine learning methods are difficult to utilize unlabeled data, which greatly limits the application scope of machine learning methods in bullet screen sentiment analysis. In this embodiment of the present invention, adopting an augmented bullet screen sample set can greatly reduce the workload of sentiment labeling and can make full use of the information of bullet screen texts without sentiment labels. In addition, it also alleviates the problem of insufficient data of a small number of samples to a certain extent, which is beneficial to better learning the data features of a small number of samples and can be applied to different scenarios. The word-level attention mechanism model and the sentence-level attention mechanism model are respectively used to fuse the features within each bullet screen text and between adjacent bullet screens in the augmented bullet screen sample set to obtain more accurate and sentiment labels, thereby improving the accuracy and reliability of the bullet screen sentiment labels.

[0114] In this embodiment of the present invention, in order to obtain the word vectors of all bullet screen texts, it is also necessary to obtain the encoding matrix of all bullet screen texts and convert the encoding matrix into word vectors. Specifically, the bullet screen text sentiment classification method may further include as Figure 2 shown in the steps. In Figure 2 , the bullet screen text sentiment classification method may further include:

[0115] In step S20, the word vectors of all bullet screen texts are calculated according to formula (1),

[0116] h s =W s h ·x i ,

[0117] x i =softmax(W s o ·h s ), (1)

[0118] where h s is the output of the hidden layer, and W s h is the mapping weight from the input layer to the hidden layer, and Ws h ∈R V×N is the mapping weight from the input layer to the hidden layer. V and N are the number of all bullet screen texts (without repetition) and the dimension of the hidden layer respectively. x i is the encoding matrix of the i-th bullet screen text. x i is the word vector of the i-th bullet screen text. i is an integer number. Each calculated value is the probability that each word in the single bullet screen text is the target word. The one with the maximum probability is the output result. softmax() is the Softmax function. W s o ∈R H×V is the mapping weight from the hidden layer to the output layer. H is the dimension of the output layer. Specifically, it is necessary to form a word library according to all bullet screen texts, and then convert all text bullet screens into one-hot encoding matrices according to this word library, that is, x i .

[0119] In step S21, calculate the objective function of the word vector according to formula (2).

[0120] L s =-logp0(w s0,1 ,w s0,2 ,…,w s0,C |w sI ), (2)

[0121] where, L s is the objective function value. w s0,C is the word vector of the C-th context word. C is a positive integer number. p0 is the conditional probability. w sI is the word vector in the middle. During the training process, the model hopes to maximize the probability of the target word. Therefore, this objective function can be used to train the model.

[0122] In steps S20 to S21, first construct a word library according to all bullet screen texts, then obtain the one-hot encoding matrix of all bullet screen texts according to this word library, and convert the one-hot encoding matrix of each bullet screen text into a word vector, which is convenient for subsequent acquisition and fusion of the information of a single bullet screen text. Adopting this way of constructing word vectors can effectively learn the information of bullet screen texts and has a high prediction accuracy.

[0123] In this embodiment of the present invention, in order to obtain the word-level information of each bullet screen text in the augmented bullet screen sample set, it is also necessary to input each bullet screen text in the augmented bullet screen sample set into the corresponding word-level GRU bidirectional gated recurrent model. Specifically, the bullet screen text sentiment classification method may further include steps as Figure 3 shown. In Figure 3 , the bullet screen text sentiment classification method may further include:[[]]

[0124] In step S30, calculate the size of the update gate in the word-level GRU bidirectional gated recurrent model according to formula (3).

[0125] z t = σ(U z1 x t+m + W z1 h t-1 + b z1 ), (3)

[0126] where z t is the size of the update gate in the word-level GRU bidirectional gated recurrent model, σ() is the Sigmoid function, U z1 is the input transformation matrix of the update gate in the word-level GRU bidirectional gated recurrent model, W z1 is the hidden transformation matrix of the update gate in the word-level GRU bidirectional gated recurrent model, b z1 is the bias of the update gate in the word-level GRU bidirectional gated recurrent model, h t-1 is the hidden state of the previous word-level information in the word-level GRU bidirectional gated recurrent model, and x t+m is the word vector of the last m bullet screen texts at the t-th time step of the augmented bullet screen sample set. m is an integer number, and -M ≤ m ≤ M, where M is a positive integer.

[0127] In step S31, calculate the size of the reset gate in the word-level GRU bidirectional gated recurrent model according to formula (4).

[0128] r t = σ(U r1 x t+m + W r1 h t-1 + b r1 ), (4)

[0129] where r t is the size of the reset gate in the word-level GRU bidirectional gated recurrent model, U r1 is the input transformation matrix of the reset gate in the word-level GRU bidirectional gated recurrent model, W r1 is the hidden transformation matrix of the reset gate in the word-level GRU bidirectional gated recurrent model, and b r1 is the bias of the reset gate in the word-level GRU bidirectional gated recurrent model.

[0130] In step S32, calculate the newly generated memory information in the word-level GRU bidirectional gated recurrent model according to formula (5).

[0131] s t = tanh(U s1 x t+m + Ws1 r t × h t-1 + b s1 ), (5)

[0132] where s t is the newly generated memory information in the word-level GRU bidirectional gated recurrent model, U s1 is the input transformation matrix of the newly generated memory information in the word-level GRU bidirectional gated recurrent model, W s1 is the hidden transformation matrix of the newly generated memory information in the word-level GRU bidirectional gated recurrent model, b s1 is the bias of the newly generated memory information in the word-level GRU bidirectional gated recurrent model, and tanh() is the activation function.

[0133] In step S33, the updated hidden state value in the word-level GRU bidirectional gated recurrent model is calculated according to formula (6),

[0134] h t = (1 - z t ) × h t-1 + z t × s t , (6)

[0135] where h t is the updated hidden state value in the word-level GRU bidirectional gated recurrent model.

[0136] In step S34, the word-level information of each barrage text in the augmented barrage sample set is calculated according to formula (7),

[0137]

[0138] where w t+m is the word-level information of the last m barrage texts at the t-th time step in the augmented barrage sample set, is the forward hidden state value, is the backward hidden state value.

[0139] In steps S30 to S34, the word vectors of each barrage text in the augmented barrage sample set are input into the word-level GRU bidirectional gated recurrent model to obtain the word-level information of each barrage text. The GRU recurrent model is adopted to make up for the defects of gradient disappearance and gradient explosion existing in the original recurrent neural network (RNN). In addition, the unidirectional GRU recurrent model calculates the processing from front to back and can only use historical information. However, the barrage text information not only has the relevance from front to back but also has the association from back to front. Therefore, the present invention adopts the GRU bidirectional gated recurrent model. The bidirectionality of the GRU bidirectional gated recurrent model can improve the flexibility of the model, obtain richer correlation features, mine the forward historical information and backward future information, and realize the comprehensive expression of the barrage emotion information features.

[0140] In this embodiment of the present invention, in order to obtain the sentence feature vector of the barrage text, it is also necessary to fuse the word-level information of each barrage. Specifically, the barrage text emotion classification method may further include the steps as Figure 4 shown. In Figure 4 , the barrage text emotion classification method may further include:

[0141] In step S40, the weight vector of the word-level attention mechanism model is calculated according to formula (8),

[0142]

[0143] where, Ω h is the weight vector of the word-level attention mechanism model, is the value of K obtained from the word-level information of the last m barrage texts at the t-th time step, is the value of Q obtained from the word-level information of the last m barrage texts at the t-th time step, is the linear mapping matrix of the Q value of the h-th head in the word-level attention mechanism model, is the linear mapping matrix of the K value of the h-th head in the word-level attention mechanism model, T represents matrix transpose, and d w is the dimension of the input word vector.

[0144] In step S41, the vector to be output of the word-level attention mechanism model is calculated according to formula (9),

[0145]

[0146] where, wsa h is the vector to be output of the word-level attention mechanism model, is the linear mapping matrix of the V value of the h-th head in the word-level attention mechanism model, The V value obtained from the word-level information of the last m bullet screen texts at the t-th time step.

[0147] In step S42, calculate the sentence feature vector of each bullet screen text in the word-level information set according to formula (10).

[0148] W t+m =Concat(wsa1,…,wsa H ), (10)

[0149] Among them, W t+m is the sentence feature vector of the last m bullet screen texts at the t-th time step in the word-level information set.

[0150] In steps S40 to S42, input the word-level information of each bullet screen into the word-level attention mechanism model to achieve the fusion of word-level information and form a sentence feature vector. The essence of the attention mechanism is to obtain the information that needs to be focused on and the information that needs to be suppressed. Its core operation is to calculate a set of weight parameters to represent the importance of each group of elements. The attention mechanism directly calculates the dependency relationship without considering the distance between variables. Compared with the traditional attention, the multi-head attention used in the present invention maps the input to different subspaces, learns the correlation of each element in the input sequence from different perspectives, and then weights and fuses the features in different subspaces and splices them into the final result. In addition, different from the original multi-head attention, the output dimension of the original multi-head attention is the same as the input. In the present invention, in order to fuse multi-time step features and reduce the subsequent calculation parameters.

[0151] In this embodiment of the present invention, in order to obtain the sentence-level information of each bullet screen text, it is also necessary to input the fused sentence feature vector into the sentence-level GRU bidirectional gated recurrent model to extract the corresponding sentence-level information. Specifically, the bullet screen text sentiment classification method may further include the steps as Figure 5 shown. In Figure 5 , the bullet screen text sentiment classification method may further include:

[0152] In step S50, calculate the size of the update gate in the sentence-level GRU bidirectional gated recurrent model according to formula (11).

[0153] Z t =σ(U z2 W t+m +W z2 H t-1 +b z2 ), (11)

[0154] Among them, Z t is the size of the update gate in the sentence-level GRU bidirectional gated recurrent model, and U z2is the input transformation matrix of the update gate in the sentence-level GRU bidirectional gated recurrent model, W z2 is the hidden transformation matrix of the update gate in the sentence-level GRU bidirectional gated recurrent model, b z2 is the bias of the update gate in the sentence-level GRU bidirectional gated recurrent model, H t-1 is the hidden state of the previous sentence-level information in the sentence-level GRU bidirectional gated recurrent model.

[0155] In step S51, calculate the size of the reset gate in the sentence-level GRU bidirectional gated recurrent model according to formula (12),

[0156] R t = σ(U r2 W t+m + W r2 h t-1 + b r2 ), (12)

[0157] where, R t is the size of the reset gate in the sentence-level GRU bidirectional gated recurrent model, U r2 is the input transformation matrix of the reset gate in the sentence-level GRU bidirectional gated recurrent model, W r2 is the hidden transformation matrix of the reset gate in the sentence-level GRU bidirectional gated recurrent model, b r2 is the bias of the reset gate in the sentence-level GRU bidirectional gated recurrent model.

[0158] In step S52, calculate the newly generated memory information in the sentence-level GRU bidirectional gated recurrent model according to formula (13),

[0159] S t = tanh(U s2 W t+m + W s2 R t × H t-1 + b s2 ), (13)

[0160] where, S t is the newly generated memory information in the sentence-level GRU bidirectional gated recurrent model, U s2 is the input change matrix of the newly generated memory information in the sentence-level GRU bidirectional gated recurrent model, W s2 is the hidden transformation matrix of the newly generated memory information in the sentence-level GRU bidirectional gated recurrent model, b s2 is the bias of the newly generated memory information in the sentence-level GRU bidirectional gated recurrent model.

[0161] In step S53, the updated hidden state value in the sentence-level GRU bidirectional gated recurrent model is calculated according to formula (14).

[0162] H t =(1 - Z t ) × H t-1 + Z t × S t , (14)

[0163] where H t is the updated hidden state value in the sentence-level GRU bidirectional gated recurrent model.

[0164] In step S54, the sentence-level information of each bullet screen text in the sentence feature vector set is calculated according to formula (15).

[0165]

[0166] where P t+m is the sentence-level signal of the bullet screen text at the (t + m)-th time step in the sentence feature vector set. is the forward hidden state value. is the backward hidden state value.

[0167] In steps S50 to S54, the sentence feature vectors are input into the sentence-level GRU bidirectional gated recurrent model to extract the corresponding sentence-level information. Since bullet screen text is different from static texts such as review text data and document data, the generation process of bullet screen text is dynamic, that is, the bullet screens sent in the video are sent within the same or similar time. For a certain picture in a video program, there will be multiple different bullet screens, and the objects and contents they express are often similar. The bullet screens in the video are scrolled in real time, and their real-time nature allows viewers to communicate through bullet screens during the same period of the video. When a user is watching a video, they can see the bullet screens sent by other users regarding the video content. Therefore, the current user's thoughts may be influenced by the bullet screens sent by other users when watching the video, resulting in an emotional tendency consistent with that of other users. In addition, bullet screen text uses concise words and has a short text length. Generally, one bullet screen is a single sentence, and there are often cases where the same user sends multiple bullet screens within a continuous period of time. Therefore, the emotional content expressed by the bullet screens appearing in the same time period has a high temporal correlation. When analyzing the emotion of each bullet screen, the bullet screen samples close to the sending moment of this bullet screen should be considered. However, the current bullet screen text analysis models usually only consider the temporal order between the words within each bullet screen, without considering the temporal order between bullet screens. Therefore, it is necessary to process the sentence feature vectors again to extract the sentence-level information of each bullet screen text to further improve the emotion prediction accuracy.

[0168] In this embodiment of the present invention, in order to obtain the augmented sample feature vector, it is also necessary to fuse the sentence-level information of each bullet screen in the augmented bullet screen sample set. Specifically, the bullet screen text sentiment classification method may further include as Figure 6 shown in the steps. In Figure 6 , the bullet screen text sentiment classification method may further include:

[0169] In step S60, calculate the weight vector of the sentence-level attention mechanism model according to formula (16),

[0170]

[0171] where, K h is the weight vector of the sentence-level attention mechanism model, is the K value obtained from the sentence-level information of the bullet screen text at the (t + m)-th time step, is the Q value obtained from the sentence-level information of the bullet screen text at the (t + m)-th time step, is the linear mapping weight of the Q value of the h-th head of the sentence-level attention mechanism model, is the linear mapping weight of the K value of the h-th head of the sentence-level attention mechanism model, T represents matrix transpose, and d p is the dimension of the input sentence vector.

[0172] In step S61, calculate the vector to be output by the sentence-level attention mechanism model according to formula (17),

[0173]

[0174] where, csa h is the vector to be output by the sentence-level attention mechanism model, is the V value obtained from the sentence-level information of the bullet screen text at the (t + m)-th time step, is the linear mapping weight of the V value of the h-th head of the sentence-level attention mechanism model.

[0175] In step S62, calculate the augmented sample feature vector according to formula (18),

[0176] L = Concat(csa1,…,csa H ), (18)

[0177] where, L is the augmented sample feature vector.

[0178] In steps S60 to S62, the word-level information of each barrage text is input into the sentence-level attention mechanism model for fusion to obtain an augmented sample feature vector. This augmented sample feature vector contains all the information of the augmented barrage sample set, that is, the mutual influence relationships within the barrage text and between the barrage texts, thereby making the information of the augmented sample feature vector more complete and more accurate.

[0179] In this embodiment of the present invention, in order to obtain the emotional attitude category vector, it is also necessary to calculate the augmented sample feature vector. Specifically,

[0180] Calculate the emotional attitude category vector according to formula (19),

[0181] E = Softmax(w E L + b E ), (19)

[0182] where E represents the emotional attitude category vector, w E represents the linear mapping matrix, and b E represents the bias.

[0183] In this embodiment of the present invention, in order to obtain the emotional category of a single barrage text labeled with an emotional label at the t-th time step, it is also necessary to process the emotional attitude category vector. Specifically, the barrage text emotional classification method may further include the steps as Figure 7 shown. In Figure 7 , the barrage text emotional classification method may further include:

[0184] In step S70, it is judged whether the positive category in the emotional attitude category vector is greater than or equal to the negative category in the emotional attitude category vector. Among them, the emotional attitude category vector includes the positive category ratio and the negative category ratio. Therefore, it is necessary to compare the positive category ratio with the negative category ratio to judge the specific emotional category of the emotional attitude category vector. Specifically, the sum of the positive ratio and the negative ratio is 1.

[0185] In step S71, when it is judged that the positive category in the emotional attitude category vector is greater than or equal to the negative category in the emotional attitude category vector, output the positive category label. Among them, if the positive category is greater than or equal to the negative category, it means that the probability of the positive category is high, and the positive category label is output.

[0186] In step S72, when it is judged that the positive category in the emotional attitude category vector is less than the negative category in the emotional attitude category vector, output the negative category label. Among them, if the positive category is less than the negative category, it means that the probability of the negative category is high, and the negative category label is output.

[0187] In steps S70 to S72, it is necessary to determine the proportion of the positive category and the negative category in the sentiment attitude category vector. If the proportion of the positive category is greater than or equal to that of the negative category, it indicates that the probability of this sentiment attitude category vector being a positive category is high. Therefore, the label of the positive category is output. On the contrary, it indicates that the probability of this sentiment attitude category vector being a negative category is high, and the label of the negative category is output.

[0188] In this embodiment of the present invention, in order to solve the problem of unbalanced barrage sentiment, the present invention adopts a cost-sensitive method to solve the unbalanced data samples to better identify the barrages with negative sentiment. During the training process of the model, the Focal Loss function is used as the objective function to optimize the parameters of the model. The Focal loss function reduces the weight of easy-to-classify samples (positive sentiment) and increases the weight of difficult-to-classify samples (negative sentiment), making the model training more focused on difficult-to-classify samples. Specifically,

[0189] Calculate the objective function of the entire model according to formula (20),

[0190] USL = -(1 - p t ) χ log(1 - p t )

[0191]

[0192] where USL is the objective function, p is the probability that the sentiment category is the positive category, p t is the probability of the sentiment category, χ is a manually set adjustment factor parameter, which is a non-negative number. χ can distinguish simple or difficult samples and reduce the loss contribution of simple samples; y is the sentiment category, y = 1 is the positive category, and y = -1 is the negative category. By adopting this objective function, the importance of a small number of negative sentiment samples in the model training process can be improved, enabling the model to focus on a small number of samples, thereby improving the classification accuracy of the model for a small number of samples while maintaining the classification accuracy for a large number of data samples.

[0193] On the other hand, the present invention also provides a computer-readable storage medium, which can store instructions for being read by a machine so that the machine executes the barrage text sentiment classification method as described above.

[0194] In this embodiment of the present invention, in order to verify the accuracy of the barrage text sentiment classification of the present invention, the following experimental verification was also carried out:

[0195] The experimental data was crawled from the bullet screen website of Bilibili. The bullet screen word segmentation made use of the Harbin Institute of Technology stop word list and the self-constructed word segmentation dictionary. A total of 11,525 data samples were randomly selected from the dataset and manually labeled. Among them, there were 10,284 samples with positive sentiment and 1,241 samples with negative sentiment. Each sample contained 5 consecutive bullet screen texts, and the sentiment annotation corresponded to the sentiment of the 3rd bullet screen data. In all the labeled datasets, 80% of the samples were used as the training set, 20% of the samples were used as the test set, and 15% of the samples in the training set were used as the validation set. During training, the training learning rate was 0.005 and the batch size was 20. In addition, this paper adopted an early stopping strategy to avoid overfitting of the model. The comparison methods included: the gated recurrent unit based on multi-head attention (MA-BiGRU), the bidirectional gated recurrent unit (BiGRU), and the support vector machine (SVM). To avoid random contingency, the models of each experiment were retrained ten times with different random seeds, and the average value was taken as the final result.

[0196] The experimental evaluation metrics were calculated based on the confusion matrix (TP, FP, FN, TN). Four metrics, namely accuracy (Accuracy), recall (R), and precision (P), were selected to evaluate the detection effect of all negative sentiment samples. The calculation methods of the above four evaluation metrics are shown in Equation (21):

[0197]

[0198]

[0199]

[0200] Among them, Accuracy is the accuracy, R is the recall, P is the precision, and TP, TN, FP, and FN are the confusion matrix.

[0201] The experimental results are shown in Table 1.

[0202] Table 1 Verification experimental results

[0203]

[0204]

[0205] Among them, SS-DHSN is the semi-supervised deep hierarchical semantic network (Semi-Supervised Deep Hierarchical Semantic Network, SS-DHSN) provided by the present invention, that is, the bullet screen text sentiment classification method based on semi-supervised deep learning. It is not difficult to see that the accuracy, recall, and precision of the bullet screen text sentiment classification method based on semi-supervised deep learning provided by the present invention are the highest.

[0206] Through the above technical solution, the method and storage medium for bullet screen text sentiment classification based on semi-supervised deep learning provided by the present invention calculate the word vectors of all bullet screen texts and randomly label some bullet screen texts, obtain the bullet screen texts before and after the labeled bullet screen texts and form an augmented bullet screen sample set, and then calculate the sentiment attitude category value of the labeled bullet screen text according to the augmented bullet screen sample set, so as to accurately identify the sentiment classification of the bullet screen text. The present invention adopts the method of randomly marking bullet screen texts and constructing an augmented bullet screen sample set, which can reduce the workload of labeling during pre-training; in addition, adopting the word-level attention mechanism model and the sentence-level attention mechanism model can obtain the mutual influence relationship between the words inside the bullet screen and between adjacent bullet screens and fuse them, so as to make the sentiment classification of the bullet screen text more accurate and reliable.

[0207] It should also be noted that the term "including", "comprising" or any other variant thereof is intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements not only includes those elements, but also includes other elements not expressly listed, or also includes elements inherent to such process, method, commodity or device. Without further limitation, an element defined by the statement "including one..." does not exclude the existence of another identical element in the process, method, commodity or device including the element.

[0208] The above are only the embodiments of the present application and are not used to limit the present application. For those skilled in the art, various changes and modifications can be made to the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included within the scope of the claims of the present application.

Claims

1. A method for sentiment classification of bullet screen text based on semi-supervised deep learning, characterized in that, Including: Randomly assign sentiment labels to all barrage texts; Obtain the word vectors of all barrage texts; Obtain the single barrage text with sentiment labels at the t-th time step and M barrage texts before and after the said barrage text, and form an augmented barrage sample set; Input the augmented barrage sample set into the word-level GRU bidirectional gated recurrent model to obtain the word-level information of each barrage text in the augmented barrage sample set, and form a word-level information set; Input the word-level information set into the word-level attention mechanism model to obtain the sentence feature vectors of each barrage text in the word-level information set, and form a sentence feature vector set; Input the sentence feature vector set into the sentence-level GRU bidirectional gated recurrent model to obtain the sentence-level information of each barrage text in the word-level feature vector set, and form a sentence-level information set; Input the sentence-level information set into the sentence-level attention mechanism model to obtain the augmented sample feature vector; Obtain the sentiment attitude category vector of the single barrage text with sentiment labels at the t-th time step according to the augmented sample feature vector; Output the sentiment category according to the sentiment attitude category vector; Obtaining the word vectors of all barrage texts includes: Calculate the word vectors of all barrage texts according to formula (1), h s = W s h · x i , x i = softmax(W s o ·h s ), (1) Among them, h s is the output of the hidden layer, W s h is the mapping weight from the input layer to the hidden layer, x i is the encoding matrix of the i-th bullet screen text, x i is the word vector of the i-th bullet screen text, i is an integer number, softmax() is the Softmax function, Ws s o is the mapping weight from the hidden layer to the output layer; Calculate the objective function of the word vectors according to formula (2), L s = -logp0(w s0,1 , w s0,2 , …, w s0,C |w sI ), (2) Among them, L s is the objective function value, w s0,C is the word vector of the C-th context word, where C is a positive integer number, p0 is the conditional probability, and w sI is the middlemost word vector.

2. The bullet screen text sentiment classification method according to claim 1, characterized in that Inputting the augmented barrage sample set into the word-level GRU bidirectional gated recurrent model to obtain the word-level information of each barrage text in the augmented barrage sample set, and forming a word-level information set includes: Calculate the size of the update gate in the word-level GRU bidirectional gated recurrent model according to formula (3), z t = σ(U z1 x t+m + W z1 h t-1 + b z1 ), (3) where z t is the size of the update gate in the word-level GRU bidirectional gated recurrent model, σ() is the Sigmoid function, U z1 is the input transformation matrix of the update gate in the word-level GRU bidirectional gated recurrent model, W z1 is the hidden transformation matrix of the update gate in the word-level GRU bidirectional gated recurrent model, b z1 is the bias of the update gate in the word-level GRU bidirectional gated recurrent model, h t-1 is the hidden state of the previous word-level information in the word-level GRU bidirectional gated recurrent model, x t+m is the word vector of the last m bullet screen texts at the t-th time step of the augmented bullet screen sample set, m is an integer number, and -M ≤ m ≤ M, M is a positive integer; Calculate the size of the reset gate in the word-level GRU bidirectional gated recurrent model according to formula (4), r t = σ(U r1 x t+m + W r1 h t-1 + b r1 ), (4) Among them, r t is the size of the reset gate in the word-level GRU bidirectional gated recurrent model, U r1 is the input transformation matrix of the reset gate in the word-level GRU bidirectional gated recurrent model, W r1 is the hidden transformation matrix of the reset gate in the word-level GRU bidirectional gated recurrent model, b r1 is the bias of the reset gate in the word-level GRU bidirectional gated recurrent model; Calculate the newly generated memory information of the word-level GRU bidirectional gated recurrent model according to formula (5), s t = tanh(U s1 x t+m + W s1 r t × h t-1 + b s1 ), (5) Among them, s t is the newly generated memory information in the word-level GRU bidirectional gated recurrent model, U s1 is the input transformation matrix of the newly generated memory information in the word-level GRU bidirectional gated recurrent model, W s1 is the hidden transformation matrix of the newly generated memory information in the word-level GRU bidirectional gated recurrent model, b s1 is the bias of the newly generated memory information in the word-level GRU bidirectional gated recurrent model, and tanh() is the activation function; Calculate the updated hidden state value of the word-level GRU bidirectional gated recurrent model according to formula (6), h t = (1 - z t ) × h t-1 + z t × s t , (6) Among them, h t is the updated hidden state value in the word-level GRU bidirectional gated recurrent model; Calculate the word-level information of each barrage text in the augmented barrage sample set according to formula (7), where w t+m is the word-level information of the last m bullet screen texts at the t-th time step of the augmented bullet screen sample set, is the forward hidden state value, is the backward hidden state value.

3. The method for classifying the sentiment of bullet screen text according to claim 2, wherein Inputting the word-level information set into the word-level attention mechanism model to obtain the sentence feature vectors of each barrage text in the word-level information set, and forming a sentence feature vector set; includes: Calculate the weight vector of the word-level attention mechanism model according to formula (8), Among them, Ω h is the weight vector of the word-level attention mechanism model, is the value of K obtained from the word-level information of the last m bullet screen texts at the t-th time step, is the value of Q obtained from the word-level information of the last m bullet screen texts at the t-th time step, is the linear mapping matrix of the Q value of the h-th head in the word-level attention mechanism model, is the linear mapping matrix of the K value of the h-th head in the word-level attention mechanism model, T represents matrix transpose, d w is the dimension of the input word vector; Calculate the vector to be output of the word-level attention mechanism model according to formula (9), Among them, wsa h is the vector to be output by the word-level attention mechanism model, is the linear mapping matrix of the V value of the h-th head in the word-level attention mechanism model, is the V value obtained from the word-level information of the last m bullet screen texts at the t-th time step; Calculate the sentence feature vector of each barrage text in the word-level information set according to formula (10), W t+m = Concat(wsa1, …, wsa H ), (10) Among them, W t+m is the sentence feature vector of the last m bullet screen texts at the t-th time step in the word-level information set.

4. The method for classifying the emotion of bullet screen text according to claim 3, wherein Inputting the sentence feature vector set into the sentence-level GRU bidirectional gated recurrent model to obtain the sentence-level information of each barrage text in the sentence feature vector set, and forming a sentence-level information set includes: Calculate the size of the update gate of the sentence-level GRU bidirectional gated recurrent model according to formula (11), Z t = σ(U z2 W t+m + W z2 H t-1 + b z2 ), (11) Among them, Z t is the size of the update gate in the sentence-level GRU bidirectional gated recurrent model, U z2 is the input transformation matrix of the update gate in the sentence-level GRU bidirectional gated recurrent model, W z2 is the hidden transformation matrix of the update gate in the sentence-level GRU bidirectional gated recurrent model, b z2 is the bias of the update gate in the sentence-level GRU bidirectional gated recurrent model, H t-2 is the hidden state of the previous sentence-level information in the sentence-level GRU bidirectional gated recurrent model; Calculate the size of the reset gate of the sentence-level GRU bidirectional gated recurrent model according to formula (12), R t = σ(U r2 W t+m + W r2 h t-1 + b r2 ), (12) wherein, R t is the size of the reset gate in the sentence-level GRU bidirectional gated recurrent model, U r2 is the input transformation matrix of the reset gate in the sentence-level GRU bidirectional gated recurrent model, W r2 is the hidden transformation matrix of the reset gate in the sentence-level GRU bidirectional gated recurrent model, b r2 is the bias of the reset gate in the sentence-level GRU bidirectional gated recurrent model; Calculate the newly generated memory information of the sentence-level GRU bidirectional gated recurrent model according to formula (13), S t = tanh(U s2 W t+m + W s2 R t × H t-1 + b s2 ), (13) Among them, S t is the newly generated memory information in the sentence-level GRU bidirectional gated recurrent model, U s2 is the input change matrix of the newly generated memory information in the sentence-level GRU bidirectional gated recurrent model, W s2 is the hidden transformation matrix of the newly generated memory information in the sentence-level GRU bidirectional gated recurrent model, b s2 is the bias of the newly generated memory information in the sentence-level GRU bidirectional gated recurrent model; Calculate the updated hidden state value of the sentence-level GRU bidirectional gated recurrent model according to formula (14), H t = (1 - Z t ) × H t-1 + Z t × S t , (14) Among them, H t is the updated hidden state value in the sentence-level GRU bidirectional gated recurrent model; Calculate the sentence-level information of each bullet screen text in the set of sentence feature vectors according to formula (15). Among them, P t+m is the sentence-level signal of the barrage text at the (t + m)-th time step in the set of sentence feature vectors, is the forward hidden state value, is the backward hidden state value.

5. The method for classifying the sentiment of bullet screen text according to claim 4, wherein Input the set of sentence-level information into the sentence-level attention mechanism model to obtain the augmented sample feature vectors, including: Calculate the weight vector of the sentence-level attention mechanism model according to formula (16). Among them, K h is the weight vector of the sentence-level attention mechanism model, is the value of K obtained from the sentence-level information of the bullet screen text at the (t + m)-th time step, is the value of Q obtained from the sentence-level information of the bullet screen text at the (t + m)-th time step, is the linear mapping weight of the Q value of the h-th head of the sentence-level attention mechanism model, is the linear mapping weight of the K value of the h-th head of the sentence-level attention mechanism model, T represents matrix transpose, d p is the dimension of the input sentence vector; Calculate the vector to be output of the sentence-level attention mechanism model according to formula (17). Among them, csa h is the vector to be output by the sentence-level attention mechanism model, is the value V obtained from the sentence-level information of the barrage text at the (t + m)-th time step, is the linear mapping weight of the value V of the h-th head of the sentence-level attention mechanism model; Calculate the augmented sample feature vectors according to formula (18). L = Concat(csa1, …, csa H ), (18) Where L is the augmented sample feature vector.

6. The method for classifying the emotion of bullet screen text according to claim 1, characterized in that Obtain the sentiment attitude category vector of a single bullet screen text labeled with a sentiment label at the t-th time step according to the augmented sample feature vector, including: Calculate the sentiment attitude category vector according to formula (19). E = Softmax(w E L + b E ), (19) Among them, E represents the emotional attitude category vector, w E represents the linear mapping matrix, b E represents the bias.

7. The method for classifying the emotion of bullet screen text according to claim 1, characterized in that The bullet screen text sentiment classification method further includes: Calculate the objective function of the entire model according to formula (20). USL = -(1 - p t ) χ log(1 - p t ), where USL is the objective function, p is the probability of the positive sentiment category, p t is the probability of the sentiment category, χ is a manually set adjustment factor parameter, which is a non - negative number, y is the sentiment category, y = 1 represents the positive category, and y = - 1 represents the negative category.

8. The method for classifying the sentiment of bullet screen text according to claim 1, wherein Output the sentiment category according to the sentiment attitude category vector, including: Judge whether the positive category in the sentiment attitude category vector is greater than or equal to the negative category in the sentiment attitude category vector; When it is judged that the positive category in the sentiment attitude category vector is greater than or equal to the negative category in the sentiment attitude category vector, output the positive category label; When it is judged that the positive category in the sentiment attitude category vector is less than the negative category in the sentiment attitude category vector, output the negative category label.

9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores instructions that are used to be read by a machine so that the machine executes the bullet screen text sentiment classification method according to any one of claims 1 to 8.

Citation Information

Patent Citations

  • An aspect-level emotion classification model and method based on dual-memory attention

    CN109472031A

  • Text aspect level sentiment analysis method

    CN112131886A