CN109840328B - Deep learning commodity comment text sentiment tendency analysis method - Google Patents
Deep learning commodity comment text sentiment tendency analysis method Download PDFInfo
- Publication number
- CN109840328B CN109840328B CN201910150859.3A CN201910150859A CN109840328B CN 109840328 B CN109840328 B CN 109840328B CN 201910150859 A CN201910150859 A CN 201910150859A CN 109840328 B CN109840328 B CN 109840328B
- Authority
- CN
- China
- Prior art keywords
- emotion
- word
- text
- weight value
- words
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Images
Landscapes
- Machine Translation (AREA)
Abstract
According to the emotion tendency analysis method for the deep learning commodity comment text, the text is processed to obtain the simplest text, the simplest text is divided into a training set and a test set, word sequences are obtained according to the training set, emotion characteristics with emotion weight values are set, the emotion weight values are adjusted to obtain corrected emotion weight values, a plurality of word group sequences are obtained according to the word sequences in different word combination forming modes, corrected emotion weight values in the word group sequences are calculated to obtain emotion labels of the text, the emotion labels are compared with artificial emotion evaluation to obtain final emotion weight values and final corrected emotion weight values, the operations are carried out on all the texts in the training set, and emotion analysis is carried out on the test set according to the emotion weight values and the final corrected emotion weight values to obtain emotion models, and emotion models are verified.
Description
Technical Field
The invention belongs to the technical field of natural language processing, and particularly relates to a method for analyzing emotion tendencies of comment texts of deep learning commodities.
Background
With the healthy development of electronic commerce in China, the flow red profit period is passed, and the cost of customers is higher and higher. How the e-commerce enterprises identify the customer consumption preference, develop accurate marketing and reduce the competitive cost is a necessary lesson for each enterprise. The commodity comment data is the evaluation of customers on the quality, price, service and the like of products after the electronic commerce transaction is completed. The commodity comment data becomes an important information source for enterprises to acquire customer consumption preference and develop accurate marketing. Such evaluation sets tend to have strong emotional tendencies. The emotional tendency of the client can be researched, so that the acceptance of the client to an enterprise can be measured, and the consumption preference of the client can be mined. At present, the field of text sentiment analysis is mainly divided into three research directions. The first is a rule and dictionary based approach: the method identifies the emotion of the text by means of an artificially constructed emotion dictionary and expert-summarized rules, generally does not consider semantic association between words, and only considers the text as a word-word set. The text emotion classification method based on the emotion dictionary has the performance which depends too much on the quality of the dictionary, and has weak capability of distinguishing the network new words and the emoticons. The second is a machine learning based approach: the method is characterized in that a machine learning classifier is used, training is carried out through manually selected linguistic features, the emotion of a text is recognized through the trained classifier, the commonly used classifier comprises naive Bayes, a maximum entropy model and a support vector machine, and the commonly used linguistic features comprise a word bag model, part of speech features, negative word features and the like. The third is a deep learning based approach: the method uses a neural network model, obtains emotion characteristics for classification through automatic learning of training on a training set, and then identifies the emotion of the text by using the trained neural network model. Common related art methods resulting therefrom are: (1) Word vector representation of the text is obtained by using a word2vec tool and is input into a trained Convolutional Neural Network (CNN) to obtain the emotional tendency of the commodity comment text. (2) The confrontation type training is applied to the field of text emotion analysis, and the robustness in the process of processing confrontation samples is improved by combining CNN. (3) Obtaining the emotion polarity value of the text by using the emotion dictionary and combining the word vector obtained by word2vec to obtain the feature vector with the emotion information, and inputting the feature vector into CNN for training. The three patents are optimized only in the input layer of the model, and then the emotion judgment is carried out by using the CNN, while the neural network is optimized, the LSTM (Long Short Term Memory) neural network and the CNN are fused, and the accuracy of text emotion analysis is improved. (4) Word vector representation of the text is obtained by adopting a word2vec tool, the word vector representation is input into an LSTM neural network to obtain a word vector with context semantic relation, then CNN is input to extract features, and finally the text emotion classification is obtained through a softmax (normalization) layer. (5) Selecting word characteristics and word vectors as double-channel input, then using CNN to classify text emotion, and (6) jointly using CNN and LSTM to process word vectors.
The deep learning is suitable for text sentiment analysis because the deep learning structure is flexible, the underlying word embedding technology can avoid processing difficulty caused by uneven text length, and the deep learning abstract features can avoid the work of manually extracting a large number of features. The technical methods (1) - (3) and the technical method (5) are optimized only in the input layer of the model, and then the emotion judgment is carried out by using the CNN, the text emotion information representation by the input of the technical methods (4) and (6) in the input layer of the neural network is simple, so that the accuracy rate of the text emotion analysis is not high,
disclosure of Invention
The present invention has been made to solve the above problems, and provides a method for analyzing emotion tendencies of comment texts of deep-learning products, which is characterized by comprising the steps of:
s1, processing the text to obtain a simplest text, and dividing the simplest text into a training set and a test set;
s2, separating the single texts in the training set word by word to obtain a corresponding word sequence, wherein the word sequence comprises a plurality of constituent words, correspondingly setting emotion characteristics for the constituent words, and setting emotion weight values for the emotion characteristics;
s3, adjusting the emotion weight values of the constituent words based on the word sequence to obtain corrected emotion weight values;
s4, obtaining a plurality of phrase sequences from the word sequences in different segmentation modes;
step S5, respectively calculating the corrected emotion weight value of each emotion characteristic in the phrase sequence, and selecting the emotion characteristic as a text emotion label of a text corresponding to the phrase sequence according to the calculation result;
s6, comparing the text emotion label with the artificial emotion evaluation of the text, changing the text emotion label by adjusting an emotion weight value and a correction emotion weight value according to a comparison result so as to enable the text emotion label to be consistent with the artificial emotion evaluation, setting the finally obtained emotion weight value as a final emotion weight value, and setting the finally obtained correction emotion weight value as a final correction emotion weight value;
s7, executing the step S2 to the step S6 to all texts in the training set;
and S8, performing emotion analysis on the test set by using an emotion model formed by the final emotion weight value and the final correction emotion weight value, and verifying the accuracy of the emotion analysis.
The method for analyzing the emotion tendencies of the deep learning commodity comment texts, provided by the invention, can also have the following characteristics: in step S1, the processing procedure includes the following substeps:
step S1-1: simplifying the text according to a preset rule to obtain a preprocessed text;
step S1-2: defining a part-of-speech for each constituent word in the preprocessed text results in a simplest text.
Step S1-3: the simplest text is divided into a training set and a test set.
In the method for analyzing emotional tendency of deep learning commodity comment text provided by the invention,
it is also possible to have the feature: in step S2, obtaining the word sequence includes the following substeps:
step S2-1: separating single texts in a training set word by word to form a plurality of constituent words;
step S2-2: identifying the constituent words and labeling the emotion characteristics of the words to the constituent words to obtain emotion characteristic words;
step S2-3: giving corresponding weight values to the emotion feature words to obtain weight feature words;
step S2-4: and connecting the plurality of weight characteristic words to obtain a word sequence.
The method for analyzing the emotion tendencies of the deep learning commodity comment texts, provided by the invention, can also have the following characteristics: in step S3, the method for obtaining the corrected emotion weight value includes:
and adjusting the emotion weight value of the composition word by combining the part before the composition word in the word sequence.
The method for analyzing the emotional tendency of the deep learning commodity comment text, provided by the invention, can also have the following characteristics: wherein, in step S4, the segmentation is performed to separate by a predetermined number of adjacent constituent words.
The method for analyzing the emotional tendency of the deep learning commodity comment text, provided by the invention, can also have the following characteristics: wherein the number of the simplest texts is 10000-30000 times.
The method for analyzing the emotional tendency of the deep learning commodity comment text, provided by the invention, can also have the following characteristics: wherein the number of the test sets is 20% -25% of the training set.
Action and effects of the invention
According to the emotion tendency analysis method for the deep learning commodity comment text, the text is processed to obtain the simplest text, the simplest text is divided into a training set and a test set, word sequences are obtained according to the training set, emotion characteristics with emotion weight values are set, the emotion weight values are adjusted to obtain corrected emotion weight values, a plurality of word group sequences are obtained according to the word sequences in different word combination forming modes, corrected emotion weight values in the word group sequences are calculated to obtain emotion labels of the text, the emotion labels are compared with artificial emotion evaluation to obtain final emotion weight values and final corrected emotion weight values, the operations are carried out on all the texts in the training set, and emotion analysis is carried out on the test set according to the emotion weight values and the final corrected emotion weight values to obtain emotion models, and emotion models are verified. Therefore, the emotion tendency of a single constituent word and the context emotion tendency of a plurality of constituent words are simultaneously considered, the accuracy of emotion analysis of the text is improved, the context relation of the text is considered, the ambiguity is eliminated to the greatest extent, richer text expressions are obtained, the emotion information representation of the text is enhanced, and the emotion analysis method for the deep learning commodity comment text is beneficial to increasing the emotion classification effect of the text and improving the emotion classification accuracy of the text.
Drawings
FIG. 1 is a flowchart of steps of a method for analyzing emotion tendencies of deep learning commodity comment texts in an embodiment of the present invention;
FIG. 2 is a data flow diagram of a method for deep learning article review text sentiment tendency analysis in an embodiment of the present invention;
FIG. 3 is a structural diagram of the inside of an LSTM neural network node of the method for analyzing emotion tendencies of deep learning commodity comment texts in the embodiment of the present invention;
FIG. 4 is a tested text sentiment accuracy curve of the deep learning merchandise review text sentiment tendency analysis method in an embodiment of the present invention;
FIG. 5 is a tested text sentiment loss rate curve of the deep learning commodity review text sentiment tendency analysis method in an embodiment of the present invention.
Detailed Description
In order to make the technical means, the creation features, the achievement purposes and the effects of the invention easy to understand, the following embodiments specifically describe the method for analyzing the emotion tendencies of the deep learning commodity comment text in combination with the accompanying drawings.
As shown in fig. 1, the method S100 for analyzing emotion tendencies of deep learning product review texts includes the following steps:
step S1: and processing the text to obtain a simplest text, and dividing the simplest text into a training set and a test set. As shown in fig. 2, the data state of this step is in 'preprocessing stage', and includes the following sub-steps:
step S1-1: simplifying the text according to a preset rule to obtain a preprocessed text;
in this embodiment, the 2012 amazon gourmet review data set is selected, the four-star and five-star review texts are marked as positive evaluations, and the one-star and two-star review texts are marked as negative evaluations. 20000 comment texts are randomly collected in this way, and 10000 comment texts with positive evaluation and 10000 negative evaluation are selected as a data set in order to keep balance of data.
Obtaining preprocessed text from a data set is performed by data cleaning, data deduplication, text word segmentation, and stop word filtering.
'data cleansing' refers to cleansing a data set by designing the following 3 regular expression rules using the python language: rule 1: removing advertising words containing specific brands in the comment text, such as Just do it (nike sports shoes), ask for more (popular shoe) and the like; rule 2: removing web addresses contained in comment text, e.g.http://,www,\.cn,\.com,\ .hkEtc.; rule 3: comment text except A-Z, a-Z, 0-9! Is it? Symbols without word meaning, such as "(", ")", "{", "}", "\\", etc. In text
'http:// www.amazon.com/gp/product/B000 GWLUGU' This taffy is so so so good! For example, after a ' data washing ', the text is converted to ' This taffy is so so so good! '.
The 'data deduplication' means that text with many repeated meanings, such as "The cake steps over good", "The cake steps re-good", "The cake steps so good", which are all expressed with one meaning, is removed from The data set, so that The data set can be simplified. The name' This taffy is so so so good! 'for example, after' data washing ', the text is converted into' This taffy is so good! '.
'text segmentation' refers to separating text by words. The abbreviations and symbols appearing in the text are regularly defined using the python language: (1) For abbreviated forms, such as I'll, they don't, etc., split into forms of [ "I", "'ll" ], [ "They", "do", "n't" ]; (2) For punctuation, it is usually treated as an independent word; (3) The last vocabulary in the comment that is connected to the punctuation mark will be separated, e.g., just do it will be correctly treated as [ "just", "do", "it", "" ]. The name' This taffy is so good! 'for example, after' text segmentation ', the text is converted into' This ',' taffy ',' is ',' so ',' good ',' | and! "'.
'stop word filtering' refers to filtering out some words with little influence on emotional tendency using a stop word dictionary commonly used in the art. Such as "do", "is", "shall", etc., removal of which can simplify the text. In terms of' ` This `, ` taffy `, ` is `, ` so `, ` good `, ` |! 'As an example, after' stop word filtering ', the text is transformed into' This ',' taffy ',' so ',' good ',' Crel! "' preprocessing text.
Step S1-2: defining a part of speech for each constituent word in the preprocessed text to obtain a simplest text;
the simplest text obtained from the preprocessed text is marked by part of speech and emotion types.
Some word performances of the words show emotional tendency, and the word characteristics are screened out to help the classification of the text emotion. 'part-of-speech tagging' refers to tagging out the part-of-speech of a word, such as a noun, verb, adjective, etc., according to the usage of the word in the comment. The invention uses python language to label part of speech. In the form of' "This", "taffy", "so", "good", "! For example, after "part of speech tagging", the text is converted to "" This/N "," taffy/N "," so/D "," good/A "," | St! X' where N represents a noun, D represents an adverb, A represents an adjective, and X represents a punctuation mark.
The 'sentiment category mark' marks the evaluation of one star and two stars in the commodity comment text as negative 0, and marks the evaluation of four stars and five stars as positive 1. In terms of' "" This/N "," taffy/N "," so/D "," good/A ","! For example,/X ' ", after the ' emotion analogy mark ', the text is transformed into ' This/N ' taffy/N" "so/D" "good/A" "| A! The simplest text of/X "" 1'. The number of simplest text selections is 10000 to 30000, and in this embodiment, the number of selections is 20000.
Step S1-3: the simplest text is divided into a training set and a test set. The number of test sets is 20% -25% of the training set. In the present embodiment, the feature data set 4:1 is divided into training set and test set.
Step S2: separating the single texts in the training set word by word to obtain a corresponding word sequence, wherein the word sequence comprises a plurality of constituent words, setting emotional characteristics corresponding to the constituent words, and setting emotional weight values for the emotional characteristics; the data state of the step is in a 'text representation stage' as shown in fig. 2, which aims to represent the text as a vector matrix of emotion characteristics which can be identified by a neural network and have emotion weight values, and the method comprises the following sub-steps:
step S2-1: separating the single text of the training set word by word to form a plurality of constituent words;
step S2-2: identifying the constituent words and labeling word emotion characteristics to the constituent words to obtain emotion characteristic words;
step S2-3: giving corresponding weight values to the emotion feature words to obtain weight feature words;
step S2-4: and connecting the plurality of weight characteristic words to obtain a word sequence.
In this embodiment, a single text in the training set is divided into a plurality of constituent words word by word, and each constituent word is trained using word2vec (google word vector tool), so as to obtain a word vector matrix containing semantic information that can be identified by a neural network and serve as one of input channels of an LSTM (long short term memory) neural network. Specifically, a word2vec (Google word vector tool) Skip-gram model is adopted to train semantic word vectors. Inputting the text after word segmentation into a model, and performing maximum semantic word vector loss function:
and obtaining a semantic word vector. The model selects a word from the context q of the target x, taking as input one word of q.
Wherein Z represents the text after word segmentation preprocessing, x represents the predicted target word, q represents the text, and x represents j Represents a word in q, j represents the number of constituent words in q, P (x) j | x) indicates that x is predicted by target x j Probability of L semantic Representing the word sense loss rate.
And constructing an expansion feature matrix by using the part-of-speech tagging result, the emotional word feature dictionary, the part-of-speech feature dictionary, the degree adverb feature dictionary, the negative word feature dictionary and the punctuation mark feature dictionary to serve as another input channel of the LSTM neural network. At this time, the composition words are labeled with corresponding emotion characteristics to form an emotion characteristic side, and the specific construction method is as follows:
first, five word characteristics which have the most obvious influence on the text emotional tendency are selected, namely emotional words, parts of speech (such as adverbs, adjectives and verbs), degree adverbs, negative words and punctuation marks (such as exclamation marks and question marks) as extension characteristics. And then respectively endowing intensity values according to the contribution intensity of each expansion feature to emotion classification, as shown in table 1, respectively selecting example words under five word features in table 1, finally mapping the text into an expansion feature vector by using the features, respectively matching each word of the text with the features, assigning the intensity values to the corresponding features when the matching is successful, and otherwise assigning the intensity values to 0.
TABLE 1
The design method of each extension feature is as follows:
(1) The emotion words are the most important consideration basis in emotion polarity determination. And selecting common positive and negative emotion words from the English emotion dictionary SentiWordNet to construct an emotion dictionary (such as positive emotion words 'like', 'love' and the like, negative emotion words 'sad', 'terrified' and the like). All words in the emotion dictionary have corresponding emotion scores, and the invention normalizes all emotion scores to [ -1,1].
(2) The research finds that the parts of speech such as verbs, adjectives and adverbs are main marks for expressing emotion, and the verbs, the adjectives and the adverbs marked in the text are selected as part of speech dictionaries;
(3) The degree adverb can change the emotional tendency degree of the emotional words when modifying the emotional words. Therefore, the introduction of the degree adverb feature can reflect the strength of emotional expression more truly. 6 levels are selected from a knowledge network HowNet knowledge base, 170 degree adverbs are selected, different weights are given to each level, and a degree adverb dictionary is constructed. Table 2 lists partial degree adverbs and their assignment cases;
TABLE 2
(4) Negative word features. Therefore, some common negative words (such as 'no', 'new' and the like) are collected as negative word dictionaries to be used for judging the emotion polarity;
(5) Punctuation is an important vector for expressing emotion, some punctuation (e.g. ' | ', '. Therefore, the punctuation mark characteristics are introduced to further enhance the effect of text representation;
and matching each word of the text through the 5 dictionaries built by the method, if the word exists in the dictionaries, giving a corresponding weight score, and if not, assigning the weight score to be 0 to obtain an expansion feature vector with a dimensionality of 5 to serve as an input channel of the LSTM neural network. In this way, the emotional feature words are given corresponding weight values to form weight feature words.
With pretreated 'This/N' taffy/N "" so/D "" good/A "" | A! For example,/X "" 1' ", after the processing of step S2, a word vector (dimension is 50) having emotional features corresponding to each word is obtained, that is, a plurality of weighted feature words are connected to obtain a word sequence:
“This/N”:[0.2613,-0.5301,0.4906,……]
“taffy/N”:[0.4561,0.1586,-0.3658,……]
“so/D”:[0.1589,0.7581,0.8451,……]
“good/A”:[-0.8436,0.4614,0.1698,……]
“!/X”:[0.6658,-0.4873,-0.9547,……]
and step S3: the emotion weight values of the constituent words are adjusted based on the word sequence to obtain corrected emotion weight values, and the data state of this step is in a 'deep feature mining stage' as shown in fig. 2.
In this embodiment, the LSTM layer is composed of LSTM units, each time sequence corresponds to one LSTM unit, the LSTM units are sequentially input at each time sequence, and then there are mainly three stages of processing inside the LSTM, as shown in fig. 3;
wherein, x in the figure t-1 Represents the input of the last time, h t-1 Representing the output of the last-in-time LSTM cell, c t-1 Representing the value, x, of the memory cell at the previous moment t Input representing the current time, h t Representing the output of the LSTM cell at the current time, c t Indicates the value of the memory cell at the current time, and σ indicates the sigmoid function (data activation function)"tanh" represents a tanh function (double-cut function), "X" represents an operation of dividing or dividing an input, "+" represents an operation of adding an input, and f t Representing the output of a forgetting gate, representing the probability of forgetting the state of a memory cell at the last moment, i t Value, o, representing the input gate at the present moment t Indicating control c t Information inflow h t How much, x of t+1 Indicates the input of the next time, h t+1 Indicating the output of the LSTM cell at the next time. The three stages of treatment are specifically:
(1) Forget the door stage. The stage is to selectively forget the output transmitted after the previous word is processed by the LSTM unit, and a sigmoid function determines to retain information related to emotional characteristics to a memory unit of the LSTM unit of the current word so as to forget the information unrelated to the emotional characteristics. This stage reads two inputs, respectively the vector x of the tth word of the sentence t And the output h of the last word (i.e. the t-1 th word) after being processed by the LSTM unit t-1 After sigmoid function screening, f is output t ,f t Is [0,1 ]]A probability in the interval, representing the pair h t-1 Degree of forgetfulness of (1) means complete retention h t-1 0 represents complete forgetting h t-1 The information of (a). f. of t Is defined as follows:
f t =σ(W f ·[h t-1 ,x t ]+b f )
in the formula: sigma is sigmoid function; w f A weight matrix for a forgetting gate; [ h ] of t-1 ,x t ]Representing the concatenation of two vectors into a longer vector, b f Is the bias term for the forgetting gate.
(2) And (4) a memory stage. This stage determines the input vector x for the t-th word t How much information is stored in the memory unit c t In the middle, the method is mainly completed by 3 steps. First decide from h by sigmoid function t-1 And x t Which information needs to be updated to get i t (ii) a Then a vector containing all possible values is created by the tanh functionI.e. alternative information to update; finally, the memory unit c of the last word t-1 And f t Multiplication, discarding information not related to emotional features, and additionMemory unit c for adding these emotion-related information to t-th word t In (1).
i t =σ(W i ·[h t-1 ,x t ]+b i )
In the formula: sigma is a sigmoid function; tan h is a tan h function; w i A weight matrix for the input gate; b is a mixture of i Is the bias term of the input gate; w c Is a weight matrix of the memory unit; b c Is the bias term of the memory cell; ' indicates the multiplication of the elements of the corresponding positions of the matrix; '-' denotes the matrix inner product.
(3) And (5) an output stage. This stage requires determining the part of the output that is relevant to the emotion. First, the current memory cell c t Processing by tanh function to obtain a value between-1 and 1, and screening c by sigmoid function t The part related to emotion is output as the t-th word and is transferred to the LSTM unit of the next word, and the same processing as the above-described steps is performed on the next word.
o t =σ(W o ·[h t-1 ,x t ]+b o )
h t =o t *tanh(c t )
In the formula: sigma is sigmoid function; w o Is a weight matrix of the output gates; b o Is the bias term of the output gate; tan h is a tan h function; o t Is [0, 1]]On intervalsProbability, screening the current memory cell c t The part related to emotion is used as output; h is t The output of the t word after being processed by the LSTM unit;
the product is expressed as "" This/N "" taffy/N "" so/D "" good/A "" I! For example,/X "" 1' ", each word can learn the emotion feature information related to the above after being processed by the LSTM unit, for example, when the vector of the word" good/a "is processed, the emotion feature weight is influenced by the above" so/D ", the corresponding emotion feature weight will be increased, if there is no emotion feature information in the above, the corresponding LSTM unit will not be processed, so the emotion weight value is adjusted to obtain a corrected emotion weight value, and the emotion weight value of the constituent word is adjusted by combining the part before the constituent word in the word sequence.
And step S4: obtaining a plurality of phrase sequences by the word sequence according to different segmentation modes; the data state of this step is in the 'deep feature mining phase' as shown in FIG. 2.
In this embodiment, the convolution layer is configured to convolve the vector matrix obtained through the LSTM neural network and considering the context and emotion feature information, i.e. the convolution operation is that the convolution kernel S ∈ R d×m (R d×m A matrix with dimension d × m) and m (the size of the sliding window of the convolution kernel) vector matrices are dot-multiplied to obtain a new sentiment feature value, which is expressed as follows: c. C j =f(S T x j-m+1:j + b), wherein x j-m+1:j The method comprises the steps of representing word vectors corresponding to j-m +1 th to j-th words in a text, b is a bias term, f is a modified Linear unit function (ReLU), convolution kernels with 3 sizes of 2, 3 and 4 are used for convolution, different convolution kernels generate feature maps of phrases containing different word numbers, and the word sequences are segmented according to the sizes of convolution kernels in 2, 3 and 4 to form 3 different phrase sequences.
Step S5: respectively calculating the corrected emotion weight value of each emotion feature in the phrase sequence, and selecting the emotion feature as a text emotion label of a text corresponding to the phrase sequence according to the calculation result; the data state of the step is in the 'emotion recognition stage' as shown in fig. 2;
in this embodiment, the phrase sequence obtained by the uniform-size processing in step S4, that is, the phrase feature map including the same number of words, is pooled. Maximum value sampling (max-posing) is adopted, the maximum weight value is reserved in a plurality of characteristic graphs, so that non-maximum values can be eliminated, and the calculation amount of an upper layer is reduced; and local dependence of different areas can be extracted, and the most remarkable information characteristics are kept. And c = max { c } of the feature map, namely extracting locally optimal features and using the locally optimal features as text emotion labels of corresponding texts.
And obtaining a final vector representation X of the word after the pooling operation, wherein the final vector representation X comprises the context emotional feature relationship and the most significant emotional feature of the part of the sentence, and inputting the final vector representation X into a softmax (normalization) layer. The invention outputs the classification result through a softmax (normalization) function, and the formula is as follows:
y=softmax(W·X+b)
X=c*r
in the formula, W is a weight matrix of the full connection layer, b is a bias term of the full connection layer, r is a regular term limit output by the pooling layer, and x is multiplication of elements at corresponding positions of the matrix.
Convolving the word vectors with convolution kernels of 3 sizes to form' ` This/N `, ` taffy/N `, ` so/D `, ` good/A `, ` | s! For example, (/ X) '1', using a convolution kernel of size 2, the sentence will be divided into phrase sequences of word number 2, such as [ "This/N" "" taffy/N "], [" taffy/N "" "so/D" ], [ "so/D" "" good/A "], [" good/A "" | ]! and/X ', performing convolution on the phrase sequences to obtain a plurality of characteristic graphs, and retaining the phrase sequences with the most obvious emotional characteristic values [ ' so/D "" good/A ' ]byadopting a maximum pooling method.
Step S6: comparing the text emotion label with the artificial emotion evaluation of the text, changing the text emotion label by adjusting an emotion weight value and a corrected emotion weight value according to a comparison result so as to enable the text emotion label to be consistent with the artificial emotion evaluation, setting the finally obtained emotion weight value as a final emotion weight value, and setting the finally obtained corrected emotion weight value as a final corrected emotion weight value; the data state of this step is in the 'emotion recognition phase' as shown in FIG. 2.
In this embodiment, a cross-entropy cost function is used as a target of model optimization, and the cross-entropy cost function is as follows:
wherein C is a class set of data, D is a training set data set, i is a class number of the data, j is a number of a training data set sample, y is an output value of a predicted emotion class of a sentence to be classified in the training set,lambda | W | non-woven count as the actual emotion category 2 Is a regular term of the loss cost function. λ is the attenuation coefficient of the regularization term and W is the fully-connected layer weight matrix. λ is a small number that can take 0.1.
The Adam algorithm is used to minimize the cross entropy loss function loss. Assuming that at time t, the first derivative of the objective function loss with respect to the neural network weight matrix parameters W is g t First, the mean value m of the gradient at the first point in time is calculated t And the second moment non-central variance value of the gradient:
m t =β 1 m t-1 +(1-β 1 )g t
wherein m is t-1 Denotes the mean value of the gradient at time t-1, v t-1 Non-central variance value representing gradient at time t-1
finally, obtaining an updating method of emotion vector matrix parameters W of the training text:
wherein, W t Expressing the emotion vector matrix parameter, W, of the training text at time t t+1 Expressing the parameters of the emotion vector matrix of the training text at the moment of t +1, wherein eta is the learning rate, epsilon is a numerical value stability constant, and the default numerical value is 10 -8 ,β 1 Is a first order momentum decay coefficient, typically 0.9, beta 2 Is a second order momentum decay coefficient, typically 0.999.
And adjusting the extended characteristic vector matrix and the training text emotion vector matrix by using an Adam algorithm, and minimizing a cross entropy loss function to ensure that the emotion classification effect of the model is most accurate.
Setting the finally obtained emotion weight value as a final emotion weight value, and setting the finally obtained correction emotion weight value as a final correction emotion weight value;
step S7: performing step S2-step S6 on all texts in the training set; so far, completing the training of the emotion analysis model;
step S8: and performing emotion analysis on the test set by using an emotion model formed by the final emotion weight value and the final correction emotion weight value, and verifying the accuracy of the emotion analysis.
In this embodiment, the final emotion weight value and the final corrected emotion weight value constitute an emotion analysis model. As shown in fig. 4 and 5, when the emotion analysis model is trained by the method, after the number of text iterations in the training set reaches 1000 times, the accuracy of the emotion analysis model of the invention is stabilized at 95%, which is 5% higher than that of a general neural network model under the same condition, and the loss rate is less than 0.05.
Effects and effects of the embodiments
According to the emotion tendency analysis method for the deep learning commodity comment text, the text is processed to obtain the simplest text, the simplest text is divided into a training set and a test set, word sequences are obtained according to the training set, emotion characteristics with emotion weight values are set, the emotion weight values are adjusted to obtain corrected emotion weight values, a plurality of word group sequences are obtained according to the word sequences in different word combination forming modes, corrected emotion weight values in the word group sequences are calculated to obtain emotion labels of the text, the emotion labels are compared with artificial emotion evaluations, a final emotion weight value and a final corrected emotion weight value are obtained, the operations are executed on all the texts in the training set, and emotion models are obtained according to the final emotion weight values and the final corrected emotion weight values to conduct emotion analysis on the test set and verify. Therefore, the method for analyzing the emotion tendencies of the deep learning commodity comment texts simultaneously considers the emotion tendencies of a single constituent word and the context emotion tendencies formed by a plurality of constituent words, improves the accuracy of emotion analysis of the texts, considers the context relation of the texts, greatly eliminates ambiguity, and obtains richer text expressions, thereby enhancing the emotion information representation of the texts, and being beneficial to increasing the emotion classification effect of the texts and improving the accuracy of emotion classification of the texts.
The above embodiments are preferred examples of the present invention, and are not intended to limit the scope of the present invention.
Claims (6)
1. A method for analyzing emotional tendency of comment texts of deep learning commodities is characterized by comprising the following steps:
s1, processing the text to obtain a simplest text, and dividing the simplest text into a training set and a test set;
s2, separating the single texts in the training set word by word to obtain a corresponding word sequence, wherein the word sequence comprises a plurality of constituent words, setting emotion characteristics corresponding to the constituent words, and setting emotion weight values for the emotion characteristics;
and S3, combining the LSTM with the part in the word sequence before the composition word, and adjusting the emotion weight value of the composition word to obtain a corrected emotion weight value, wherein the emotion weight value is adjusted in the following way: after the LSTM unit processing is carried out on each word, the emotion feature information related to the word can be learned, the corresponding emotion feature weight is increased, if the emotion feature information does not exist in the word, the LSTM unit does not process the word, the emotion weight value is adjusted to obtain the corrected emotion weight value, and the emotion weight value of the formed word is adjusted by combining the part in front of the formed word in the word sequence;
s4, segmenting the word sequence by adopting convolution kernels with different sizes to obtain a plurality of phrase sequences, wherein the phrase sequences are constructed by the following steps: the convolution layer is set to carry out convolution on a vector matrix which is obtained through an LSTM neural network and takes context and emotion characteristic information into consideration, and convolution operation is carried out, namely a convolution kernel S belongs to R d×m And performing point multiplication on the m vector matrixes to obtain a new emotion characteristic value, wherein the new emotion characteristic value is as follows: c. C j =f(S T x j-m+1:j + b), wherein R is d×m Representing a matrix with dimension d × m, m being the sliding window size of the convolution kernel, x j-m+1:j Representing word vectors corresponding to the j-m +1 th word to the j-th word in a text, b being a bias term, f being a modified linear unit function, performing convolution by using convolution kernels with 3 sizes of 2, 3 and 4, wherein different convolution kernels generate feature maps of word groups containing different word numbers, and the word sequence is segmented according to the sizes of the convolution kernels of 2, 3 and 4 to form 3 different word group sequences;
s5, respectively calculating the corrected emotion weight value of each emotion feature in the phrase sequence, and selecting the emotion feature as a text emotion label of the text corresponding to the phrase sequence according to a calculation result;
s6, comparing the text emotion label with the artificial emotion evaluation of the text, changing the text emotion label by adjusting the emotion weight value and the correction emotion weight value according to a comparison result so as to enable the text emotion label to be consistent with the artificial emotion evaluation, setting a finally obtained emotion weight value as a final emotion weight value, and setting a finally obtained correction emotion weight value as a final correction emotion weight value;
s7, executing S2-S6 on all texts in the training set;
and S8, performing emotion analysis on the test set by using an emotion model formed by the final emotion weight value and the final correction emotion weight value, and verifying the accuracy of the emotion analysis.
2. The method for analyzing emotional tendency of deep learning commodity comment texts according to claim 1, wherein:
in step S1, the processing procedure includes the following substeps:
step S1-1: simplifying the text according to a preset rule to obtain a preprocessed text;
step S1-2: defining a part of speech for each constituent word in the preprocessed text to obtain a simplest text;
step S1-3: and dividing the simplest text into a training set and a testing set.
3. The method for analyzing emotional tendency of deep learning commodity comment texts according to claim 1, wherein:
wherein, in step S2, obtaining the word sequence includes the following substeps:
step S2-1: separating the single texts in the training set word by word to form a plurality of the composition words;
step S2-2: identifying the composition words and labeling emotion characteristics of the composition words to obtain emotion characteristic words;
step S2-3: giving corresponding weight values to the emotional feature words to obtain weight feature words;
step S2-4: and connecting a plurality of the weight characteristic words to obtain a word sequence.
4. The deep learning commodity comment text sentiment tendency analysis method according to claim 1, characterized in that:
in step S3, the method for obtaining the corrected emotion weight value includes:
and adjusting the emotion weight value of the composition word by combining the part before the composition word in the word sequence.
5. The deep learning commodity comment text sentiment tendency analysis method according to claim 1, characterized in that:
wherein the number of the simplest texts is 10000-30000 times.
6. The method for analyzing emotional tendency of deep learning commodity comment texts according to claim 1, wherein:
wherein the number of the test sets is 20% -25% of the training set.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910150859.3A CN109840328B (en) | 2019-02-28 | 2019-02-28 | Deep learning commodity comment text sentiment tendency analysis method |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910150859.3A CN109840328B (en) | 2019-02-28 | 2019-02-28 | Deep learning commodity comment text sentiment tendency analysis method |
Publications (2)
Publication Number | Publication Date |
---|---|
CN109840328A CN109840328A (en) | 2019-06-04 |
CN109840328B true CN109840328B (en) | 2022-12-27 |
Family
ID=66885213
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910150859.3A Active CN109840328B (en) | 2019-02-28 | 2019-02-28 | Deep learning commodity comment text sentiment tendency analysis method |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN109840328B (en) |
Families Citing this family (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110263344B (en) * | 2019-06-25 | 2022-04-19 | 创优数字科技(广东)有限公司 | Text emotion analysis method, device and equipment based on hybrid model |
CN110442677A (en) * | 2019-07-04 | 2019-11-12 | 平安科技(深圳)有限公司 | Text matches degree detection method, device, computer equipment and readable storage medium storing program for executing |
CN110427616B (en) * | 2019-07-19 | 2023-06-09 | 山东科技大学 | A Text Sentiment Analysis Method Based on Deep Learning |
CN111488456A (en) * | 2020-04-10 | 2020-08-04 | 北京洛必德科技有限公司 | Merchant user evaluation analysis method and system |
CN113536802A (en) * | 2020-04-21 | 2021-10-22 | 北京中科闻歌科技股份有限公司 | Method, device, equipment and storage medium for judging emotion of text data in languages |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106294316A (en) * | 2016-07-29 | 2017-01-04 | 陕西师范大学 | A kind of text emotion based on dictionary analyzes method |
CN106503049A (en) * | 2016-09-22 | 2017-03-15 | 南京理工大学 | A kind of microblog emotional sorting technique for merging multiple affection resources based on SVM |
CN108427670A (en) * | 2018-04-08 | 2018-08-21 | 重庆邮电大学 | A kind of sentiment analysis method based on context word vector sum deep learning |
CN108763326A (en) * | 2018-05-04 | 2018-11-06 | 南京邮电大学 | A kind of sentiment analysis model building method of the diversified convolutional neural networks of feature based |
-
2019
- 2019-02-28 CN CN201910150859.3A patent/CN109840328B/en active Active
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106294316A (en) * | 2016-07-29 | 2017-01-04 | 陕西师范大学 | A kind of text emotion based on dictionary analyzes method |
CN106503049A (en) * | 2016-09-22 | 2017-03-15 | 南京理工大学 | A kind of microblog emotional sorting technique for merging multiple affection resources based on SVM |
CN108427670A (en) * | 2018-04-08 | 2018-08-21 | 重庆邮电大学 | A kind of sentiment analysis method based on context word vector sum deep learning |
CN108763326A (en) * | 2018-05-04 | 2018-11-06 | 南京邮电大学 | A kind of sentiment analysis model building method of the diversified convolutional neural networks of feature based |
Non-Patent Citations (3)
Title |
---|
一种结合深度学习和集成学习的情感分析模型;金志刚等;《哈尔滨工业大学学报》;20180504(第11期);全文 * |
基于多通道卷积神经网络的中文微博情感分析;陈珂等;《计算机研究与发展》;20180515(第05期);全文 * |
基于情感词属性和云模型的文本情感分类方法;孙劲光等;《计算机工程》;20131028(第12期);全文 * |
Also Published As
Publication number | Publication date |
---|---|
CN109840328A (en) | 2019-06-04 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109902177B (en) | Text emotion analysis method based on dual-channel convolutional memory neural network | |
CN109840328B (en) | Deep learning commodity comment text sentiment tendency analysis method | |
CN111858945B (en) | Deep learning-based comment text aspect emotion classification method and system | |
CN111209738B (en) | Multi-task named entity recognition method combining text classification | |
CN108446271B (en) | Text emotion analysis method of convolutional neural network based on Chinese character component characteristics | |
CN108829818B (en) | A text classification method | |
Pröllochs et al. | Negation scope detection in sentiment analysis: Decision support for news-driven trading | |
Morsomme et al. | Content-Based Course Recommender System for Liberal Arts Education. | |
CN110929034A (en) | Commodity comment fine-grained emotion classification method based on improved LSTM | |
CN107491531A (en) | Chinese network comment sensibility classification method based on integrated study framework | |
CN110188272A (en) | A tag recommendation method for community Q&A websites based on user background | |
CN106599032A (en) | Text event extraction method in combination of sparse coding and structural perceptron | |
CN111400494B (en) | A sentiment analysis method based on GCN-Attention | |
CN112364638A (en) | Personality identification method based on social text | |
CN111222318A (en) | Trigger word recognition method based on two-channel bidirectional LSTM-CRF network | |
Hamim et al. | Student profile modeling using boosting algorithms | |
CN109726745A (en) | A goal-based sentiment classification method incorporating descriptive knowledge | |
CN110851593B (en) | Complex value word vector construction method based on position and semantics | |
CN114417851B (en) | Emotion analysis method based on keyword weighted information | |
JP7303243B2 (en) | Exam question prediction system and exam question prediction method | |
CN114942974A (en) | E-commerce platform commodity user evaluation emotional tendency classification method | |
CN112950019B (en) | Electricity selling company evaluation emotion classification method based on joint attention mechanism | |
Pröllochs et al. | Detecting negation scopes for financial news sentiment using reinforcement learning | |
Zhao et al. | ALS-MRS: Incorporating aspect-level sentiment for abstractive multi-review summarization | |
CN115481219A (en) | Electricity selling company evaluation emotion classification method based on grammar sequence embedded model |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |