CN111651593A - Text emotion analysis method based on word vector and word vector mixed model - Google Patents

Text emotion analysis method based on word vector and word vector mixed model Download PDF

Info

Publication number
CN111651593A
CN111651593A CN202010379545.3A CN202010379545A CN111651593A CN 111651593 A CN111651593 A CN 111651593A CN 202010379545 A CN202010379545 A CN 202010379545A CN 111651593 A CN111651593 A CN 111651593A
Authority
CN
China
Prior art keywords
word vector
text
matrix
word
layer
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.)
Pending
Application number
CN202010379545.3A
Other languages
Chinese (zh)
Inventor
余伟阳
黄钰杰
王宝基
李晓华
李辉
张云飞
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Henan University of Technology
Original Assignee
Henan University of Technology
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Henan University of Technology filed Critical Henan University of Technology
Priority to CN202010379545.3A priority Critical patent/CN111651593A/en
Publication of CN111651593A publication Critical patent/CN111651593A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/35Clustering; Classification
    • G06F16/355Class or cluster creation or modification
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/20Natural language analysis
    • G06F40/237Lexical tools
    • G06F40/242Dictionaries
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/20Natural language analysis
    • G06F40/279Recognition of textual entities
    • G06F40/289Phrasal analysis, e.g. finite state techniques or chunking
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/30Semantic analysis
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/045Combinations of networks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/047Probabilistic or stochastic networks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/049Temporal neural networks, e.g. delay elements, oscillating neurons or pulsed inputs
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Artificial Intelligence (AREA)
  • General Health & Medical Sciences (AREA)
  • Health & Medical Sciences (AREA)
  • Computational Linguistics (AREA)
  • Data Mining & Analysis (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Evolutionary Computation (AREA)
  • Molecular Biology (AREA)
  • Computing Systems (AREA)
  • Biomedical Technology (AREA)
  • Biophysics (AREA)
  • Mathematical Physics (AREA)
  • Software Systems (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Probability & Statistics with Applications (AREA)
  • Databases & Information Systems (AREA)
  • Machine Translation (AREA)

Abstract

The invention provides a text emotion analysis method based on a word vector and word vector mixed model, aiming at the problems that emotion information expression is insufficient, words are considered only and other text characteristics are ignored in the current text emotion analysis, and the method comprises the following steps: firstly, preprocessing a Chinese data set, and training a Word vector and a Word vector matrix by using Word2 Vec; then, the word vectors and the word vectors are used as input data and are respectively sent into a Convolutional Neural Network (CNN) and a bidirectional long-short term memory network (BilSTM) for feature extraction; two attention layers are introduced to learn important text features; and finally, combining the text features extracted by the two channels, and classifying the output by using a classification layer. The method provided by the invention has significance and superiority on Chinese data sets.

Description

Text emotion analysis method based on word vector and word vector mixed model
Technical Field
The invention provides a text emotion analysis method based on a word vector and word vector mixed model, and relates to the field of text emotion analysis.
Background
In recent years, with the rapid development of the internet industry, a plurality of new media appear, a large amount of data such as user comments, brands, emotions, politics, viewpoints and the like can be obtained through the internet, emotion analysis is a special text mining work, attitudes or emotions of people are extracted from given texts, at present, text emotion analysis is an important research direction in the field of Natural Language Processing (NLP), aims at unstructured information, mines deep-level emotions or tendencies of the implications of the information, is more and more emphasized by academic circles and industrial circles, is different from images and voices, and has own characteristics in many aspects.
The main task of the text sentiment analysis is to analyze, process, summarize and judge the text with sentiment colors. At present, text emotion analysis methods mainly comprise two methods, namely a method based on an emotion dictionary and a method based on machine learning, wherein the emotion analysis technology based on machine learning is used for text analysis, although good effects are achieved, the methods cannot effectively express complex function calculation, data features need to be selected manually, generalization capability is weak, deep learning can automatically learn important data features from original data, various complex tasks are processed, advantages in modeling, explanation, expression capability, optimization and the like are obvious, the deep learning is applied to the field of text emotion analysis, and research and development of text emotion analysis are greatly promoted.
In order to overcome the defects of traditional machine learning and an emotion dictionary-based method algorithm, a deep learning algorithm is utilized to process an NLP task, a Recurrent Neural Network (RNN) and a Convolutional Neural Network (CNN) are the most widely used Network models in a text emotion analysis task, however, in a text, the influence of a single word vector on the emotion polarity of the whole text is only considered, so that the semantic acquisition of the text is insufficient, the two Neural networks are the overall characteristics of the learning text, and the Neural Network structure with a vertical structure cannot effectively and comprehensively extract the text characteristics with a deeper level.
The invention provides a text emotion analysis method based on a Word vector and Word vector mixed model, which comprises the steps of constructing a Word vector and Word vector based mixed model (BilSTM-CNN-attribute), carrying out Word segmentation, Word filtering, Word stopping and other preprocessing on a Chinese data set, training a Word vector and a Word vector matrix by using Word2Vec, and then respectively sending the Word vector and the Word vector as input data into a convolutional neural network and a bidirectional Long and short term Memory network (Bi-directional Long and short term Memory, BilSTM) for feature extraction; compared with a deep learning network which only considers word vector characteristics generally, the method can fully extract local characteristics and sequence information of the text, solve the problem of semantic multi-level, and can learn the important information characteristics of the text through the attention mechanism, and the accuracy of the method can reach 92.67% on a text data set.
Disclosure of Invention
In view of the above, the main objective of the present invention is to combine the advantages of the convolutional neural network and the two-way long-short term memory network, use the word vector and the word vector as the input of the model at the same time, and add the attention layer after that to extract the important text information features, thereby improving the accuracy of the text emotion analysis.
In order to achieve the purpose, the technical scheme provided by the invention is as follows:
the text emotion analysis method based on the word vector and word vector mixed model comprises the following steps:
step 1, preprocessing a Chinese data set, and simultaneously training a Word vector and a Word vector matrix by using Word2 Vec;
step 2, training the word vector matrix x1:lAnd word vector matrix w1:lAs the input characteristics of the bidirectional long and short term memory network, the sequence characteristics of the text are learned, and the attention layer is accessed to optimize the characteristic vector;
step 3, training the word vector matrix x1:lAnd word vector matrix w1:lAs the input features of the convolutional neural network, performing convolution and pooling operations to learn local features of the text, and accessing an attention mechanism to obtain deep features of the text;
step 4, extracting the features s from the convolutional neural network layer with the attention mechanismcAnd feature vectors s extracted by a bidirectional long-term and short-term memory network layer introducing an attention mechanismlAnd fusing, inputting a softmax classification layer for classification, wherein the positive value is 1, the negative value is 0, and comparing and calculating with the text label to obtain the text classification accuracy.
In summary, the invention integrates the convolutional neural network and the bidirectional long and short term memory network based on the word vector and the word vector, and introduces the attention mechanism to learn important text information, which is essentially to use the word vector and the word vector as the input of the convolutional neural network and the bidirectional long and short term memory network at the same time, use the bidirectional long and short term memory network to learn sequence information, obtain local features of the text by means of the convolutional neural network, and then use two attention layers to identify important features, thereby improving the accuracy of model emotion classification.
Description of the drawings:
FIG. 1 is a schematic general flow chart of a text emotion analysis method based on a word vector and word vector hybrid model according to the present invention;
FIG. 2 is a schematic flow chart of training Word vectors and Word vectors using Word2 Vec;
FIG. 3 is a schematic flow chart of sequence feature extraction using a BilSTM network;
FIG. 4 is a schematic diagram of a process for extracting local features using a CNN network;
FIG. 5 is a schematic diagram of a process of calculating the text classification accuracy by using a Softmax classification layer for classification;
FIG. 6 shows the accuracy results obtained after experiments using the Chinese data set;
fig. 7 is an overall construction diagram of a word vector and word vector hybrid model according to the present invention.
The specific implementation mode is as follows:
the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings, it is obvious that the examples are for illustration and not for limiting the embodiments of the present invention, the present invention can also be implemented by other different specific embodiments, and all other embodiments obtained by those skilled in the art without any inventive work are within the scope of the present invention.
Fig. 1 is a general flow diagram of a text emotion analysis method based on a word vector and word vector hybrid model according to the present invention, and as shown in fig. 1, the text emotion analysis method based on a word vector and word vector hybrid model according to the present invention includes the following steps:
step 1, preprocessing a Chinese data set, and simultaneously training a Word vector and a Word vector matrix by using Word2 Vec;
step 2, training the word vector matrix x1:lAnd word vector matrix w1:lAs the input characteristics of the bidirectional long and short term memory network, the sequence characteristics of the text are learned, and the attention layer is accessed to optimize the characteristic vector;
step 3, training the word vector matrix x1:lAnd word vector matrix w1:lAs the input features of the convolutional neural network, performing convolution and pooling operations to learn local features of the text, and accessing an attention mechanism to obtain deep features of the text;
step 4, extracting the features s from the convolutional neural network layer with the attention mechanismcAnd feature vectors s extracted by a bidirectional long-term and short-term memory network layer introducing an attention mechanismlAnd fusing, inputting a softmax classification layer for classification, wherein the positive value is 1, the negative value is 0, and comparing and calculating with the text label to obtain the text classification accuracy.
Fig. 2 is a schematic flow chart of training Word vectors and Word vectors using Word2Vec, as shown in fig. 2, in step 1, a preprocessing operation is performed on a chinese data set, and Word vectors and Word vector matrices are simultaneously trained using Word2Vec, including the following steps:
step 11, preprocessing the text to improve the quality of word vectors, including a Stop word and a word segmentation process, wherein the specific process of the Stop word refers to selecting a work-of-the-job Stop word list, eliminating Stop Words (Stop Words) in a data set, the Stop Words refer to certain Words which have high frequency and are meaningless in the text, such as pronouns, mood-aid Words, prepositions, conjunctions and the like, because the text format is not standardized enough, the Words without special meaning are filtered out in the preprocessing stage, interference of irrelevant information is reduced, the quality of the word vectors is greatly improved, and the specific process of the word segmentation refers to an accurate word segmentation mode of Jieba word segmentation which can accurately separate Chinese texts according to reading habits according to a specific dictionary;
step 12, using a Word2vec tool opened by Google corporation for Word vector training work, training Word vectors and Word vectors by using a Skip-gram model in the Word2vec tool, training preprocessed corpus into 128-dimensional Word vectors and Word vectors, and respectively representing a Word vector matrix and a Word vector matrix as follows:
Figure RE-GDA0002608966930000031
Figure RE-GDA0002608966930000032
wherein the content of the first and second substances,
Figure RE-GDA0002608966930000033
representing the join operator, l representing the length of the sentence, and taking a constant value of 60, x1:lWord vector matrix, w, representing 60 × 1281:lRepresenting a 60 × 128 word vector matrix.
FIG. 3 is a flow chart of sequence feature extraction using a two-way long-short term memory networkFIG. 3 shows that in step 2, the trained word vector matrix x1:lAnd word vector matrix w1:lAs the input features of the bidirectional long-short term memory network, the sequence features of the text are learned, and the attention layer optimization feature vector is accessed, and the method comprises the following steps:
step 21, converting the word vector matrix x1:lAnd word vector matrix w1:lRespectively inputting the results into a BilSTM network for training, extracting features by using the BilSTM network to obtain sequence features of texts, improving the convergence of the network, and obtaining a hidden state h of a character vector of the BilSTM networkwiHidden state h of sum word vectorxiA matrix x of word vectors to be converted1:lInputting the result into a BilSTM network for training to obtain a hidden state h of a BilSTM network word vectorxiThe formula is expressed as:
ft=σ(wfx1:l+ufht-1+bf)
it=σ(wix1:l+uiht-1+bi)
ot=σ(wox1:l+uoht-1+bo)
Figure RE-GDA0002608966930000041
Figure RE-GDA0002608966930000042
Figure RE-GDA0002608966930000043
Figure RE-GDA0002608966930000044
Figure RE-GDA0002608966930000045
Figure RE-GDA0002608966930000046
wherein sigma is sigmoid activation function, and the output is [0,1 ]]And determines how much information can pass through, tanh is a hyperbolic tangent function,
Figure RE-GDA0002608966930000047
operator symbol representing a matrix multiplication operation, forgetting gate ftDeciding to "forget" information that is not important in the back-propagation, input gate itDetermines the information to be updated
Figure RE-GDA0002608966930000048
Output gate otDetermining from the current cell state ctOutput to hidden layer state hxtThe content of (1). Current cell state ctThat is, the past cell state ct-1Merging with new memory, w(i)And u(i)Representing weights in the data processing process, a matrix w of word vectors to be converted1:lInputting the result into a BilSTM network for training to obtain a hidden layer state h of a BilSTM network word vectorwiThe formula is expressed as:
ft=σ(wfw1:l+ufht-1+bf)
it=σ(wiw1:l+uiht-1+bi)
ot=σ(wow1:l+uoht-1+bo)
Figure RE-GDA0002608966930000049
Figure RE-GDA00026089669300000410
Figure RE-GDA00026089669300000411
Figure RE-GDA0002608966930000051
Figure RE-GDA0002608966930000052
Figure RE-GDA0002608966930000053
wherein sigma is sigmoid activation function, and the output is [0,1 ]]And determines how much information can pass through, tanh is a hyperbolic tangent function,
Figure RE-GDA0002608966930000054
operator symbol representing a matrix multiplication operation, forgetting gate ftDeciding to "forget" information that is not important in the back-propagation, input gate itDetermines the information to be updated
Figure RE-GDA0002608966930000055
Output gate otDetermining from the current cell state ctOutput to hidden layer state hwtThe content of (1). Current cell state ctThat is, the past cell state ct-1Merging with new memory, w(i)And u(i)Representing the weight in the data processing process;
step 22, the hidden layer state h of the BiLSTM network word vector obtained in the step 21 is used forwiHidden state h of sum word vectorxiThe fusion is performed by using a point multiplication mode, and the formula is expressed as follows:
hi=[hwi·hxi]
step 23, hiding layer state h in the BilSTM networkiNonlinear transformation uiIs expressed as
ui=tanh(wwhi+bw)
Wherein, wwAnd bwRepresenting a weight matrix and a weight vector;
step 24, using softmax function to pair uiNormalization is performed to obtain an attention matrix, i.e., output weighting coefficients α of the BilSTM layeriThe formula is expressed as:
Figure RE-GDA0002608966930000056
wherein u iswThe initialized weight matrix is shown;
step 25, output weight coefficient α of BilSTM layer obtained in step 24iAnd hidden layer state h obtained in step 22iMultiplying to obtain a feature vector s extracted from the BilSTM layer and introducing an attention mechanismlThe formula is expressed as:
Figure RE-GDA0002608966930000057
wherein, αiExpressed is the output weight coefficient, hiThe hidden state obtained in step 22 is shown.
FIG. 4 is a schematic diagram of a process of extracting local features by using a convolutional neural network, as shown in FIG. 4, in step 3, a word vector matrix x to be trained1:lAnd word vector matrix w1:lThe method is used as the input feature of the convolutional neural network, the local feature of the text is learned through convolution and pooling operation, and the attention mechanism is accessed to obtain the deep feature of the text, and the method comprises the following steps:
step 31, training the word vector matrix x1:lAnd word vector matrix w1:lThe input signals are respectively input into a CNN network for training, and the convolution operation is performed by using a linear filter on an input matrix, which can be expressed as follows:
Cxi=f(W·x1:l+b)
Cwi=f(W·w1:l+b)
wherein b ∈ R denotes a bias vector, W denotes a convolution kernel with a height h of 3, 4, 5 and a width d of 128, f denotes a nonlinear activation function, and a ReLu function is used as the activation function, which is expressed as:
f(x)=max(0,x)
step 32, for the trained word vector matrix x1:lAnd word vector matrix w1:lAfter convolution operation, a word vector characteristic diagram C is obtainedxSum word vector feature map Cw
Cx=[Cx1,Cx2,…,Cxl]
Cw=[Cw1,Cw2,…,Cwl]
Combining the local features extracted by the convolution kernels, and selecting 128 convolution kernels to obtain a plurality of feature maps representing different feature information for extracting more text features;
step 33, after completing the operation of step 32, matching the word vector feature map CxSum word vector feature map CwPerforming maximum pooling operation to obtain word vector output characteristics cxiSum word vector output feature cwiReducing the characteristic dimension, the formula is expressed as:
cxi=max(Cx)
cwi=max(Cw)
then outputting the word vector to the feature c at the fusion layerxiSum word vector output feature cwiThe point multiplication mode is used for fusion, and the formula is expressed as follows:
ci=[cxi·cwi]
step 34, using tanh function to compare the characteristic c obtained in step 33iNonlinear transformation uciThe formula is expressed as:
uci=tanh(wwci+bw)
wherein, wwAnd bwRepresenting the weight matrix and weight vector, and then using the Softmax function to pair uciNormalization is carried out to obtain an output weight coefficient α of the CNN layerciThe formula is expressed as:
Figure RE-GDA0002608966930000061
wherein u iscwThe initialized weight matrix is shown;
step 35, outputting the weight coefficient α of the convolution neural layer obtained in step 34ciWith the feature c obtained in step 33iMultiplying to obtain text features extracted after the CNN passes through the attention layer, and expressing the text features as a vector sc
Figure RE-GDA0002608966930000062
Wherein, αciThe output weight coefficients are indicated.
FIG. 5 is a schematic diagram of a process of classifying by using a Softmax classification layer and calculating the text classification accuracy, and in step 4, features s extracted by a convolutional neural network layer with attention mechanism introducedcAnd feature vectors s extracted by a bidirectional long-short term memory network layer introducing an attention mechanismlFusing, inputting a softmax classification layer for classification, positively setting the classification to be 1 and negatively setting the classification to be 0, and comparing and calculating with the text label to obtain the text classification accuracy, wherein the method comprises the following steps:
step 41, extracting features s of the convolutional neural layer with attention mechanismcAnd feature vectors s extracted by a bidirectional long-short term memory network layer introducing an attention mechanismlAnd accessing a full connection layer by using a point-product fusion mode to obtain output characteristics:
x=[sl·sc]
step 42, adopting a Dropout strategy, wherein the main idea is that during model training, a part of the method is randomly selected and temporarily discarded from the network, namely, the neural units are temporarily inactivated and do not participate in parameter updating operation any more, and the Dropout rate is set to be 0.5, namely, half of the neurons do not participate in calculation in each iteration;
step 43, taking the feature x obtained in step 41 as an input of the classification layer, and calculating the probability size p of each text belonging to different categories by using a softmax function, which can be described as the following formula:
Figure RE-GDA0002608966930000071
where the text is divided into 2 categories, wkAnd bkIs the weight and bias of the layer;
and 44, judging the text type, judging that the probability value p belongs to a larger type, positively being 1, and negatively being 0, and comparing the probability value p with the text label to calculate to obtain the text accuracy.
Examples
In the embodiment, real Chinese comments collected from the Internet are adopted, and the text emotion is analyzed by using a text emotion analysis method based on a word vector and word vector mixed model, and the specific steps are as follows:
1. preprocessing a text set, using a crust word segmentation, then performing word-off-stop processing, endowing the text with a label, wherein the positive is 1, the negative is 0,
2. vectorizing the text, training Word vectors and Word vectors by using a Word2Vec tool, setting the dimensions of the Word vectors and the Word vectors to be 128, fixing the length of the sentence to be 60, obtaining a Word vector matrix and a Word vector matrix,
3. the word vector matrix and the word vector matrix are respectively used as the input characteristics of the two-way long and short term memory network and the convolutional neural network, wherein the convolutional kernel size of the convolutional neural network is set to be 3, 4 and 5, the number of the convolutional kernels is 128, the number of the hidden layer neurons of the two-way long and short term memory network is set to be 128, in order to prevent overfitting, the Dropout rate is set to be 0.5,
4. after the bidirectional long-short term memory network and the convolutional neural network are respectively accessed to the attention layer to extract important characteristic information, the size of the attention layer is consistent with the size of the extracted characteristic of the channel,
5. the features obtained by the two channels are simultaneously input into the full connection layer to be combined, and finally input into the classification layer to be classified, so that a correct rate result shown in fig. 6 is obtained, wherein the horizontal axis represents the number of experimental iterations, and the vertical axis represents the correct rate, wherein the W-CNN model marked as a circle, the W-BilSTM model marked as an arrow, the W-CNN-BilSTM model marked as a pentagon, the W-ATCNN-ATBilSTM model marked as an inverted triangle, and the model marked as a square are the models constructed by the method of the present invention, and the correct rate of the models on the data set is up to 92.67%.

Claims (5)

1. The text emotion analysis method based on the word vector and word vector mixed model is characterized by comprising the following steps of:
step 1, preprocessing a Chinese data set, and simultaneously training a Word vector and a Word vector matrix by using Word2 Vec;
step 2, training the word vector matrix x1:lAnd word vector matrix w1:lAs the input characteristics of the bidirectional long and short term memory network, the sequence characteristics of the text are learned, and the attention layer is accessed to optimize the characteristic vector;
step 3, training the word vector matrix x1:lAnd word vector matrix w1:lAs the input features of the convolutional neural network, performing convolution and pooling operations to learn local features of the text, and accessing an attention mechanism to obtain deep features of the text;
step 4, extracting the features s from the convolutional neural network layer with the attention mechanismcAnd feature vectors s extracted by a bidirectional long-short term memory network layer introducing attention mechanismlAnd fusing, inputting a softmax classification layer for classification, wherein the positive value is 1, the negative value is 0, and comparing and calculating with the text label to obtain the text classification accuracy.
2. The text emotion analysis method based on the Word vector and Word vector hybrid model as claimed in claim 1, wherein in step 1, preprocessing operation is performed on the chinese data set, and Word vector matrix are trained simultaneously using Word2Vec, comprising the steps of:
step 11, preprocessing the text to improve the quality of word vectors, including the processes of word stop and word segmentation;
step 12, using a Word2vec tool open by Google corporation for Word vector training work, using a Skip-gram model in the Word2vec tool to train Word vectors and Word vectors, and training the preprocessed corpus into 128-dimensional Word vectors and Word vectors, wherein a Word vector matrix and a Word vector matrix are respectively expressed as:
Figure RE-FDA0002608966920000011
Figure RE-FDA0002608966920000012
wherein the content of the first and second substances,
Figure RE-FDA0002608966920000013
representing the join operator, l representing the length of the sentence, and taking a constant value of 60, x1:lWord vector matrix, w, representing 60 × 1281:lRepresenting a 60 × 128 word vector matrix.
3. The method for emotion analysis of text based on mixed model of word vector and word vector as claimed in claim 1, wherein in step 2, the trained word vector matrix x is used1:lAnd word vector matrix w1:lAs an input feature of BilSTM, learning a sequence feature of a text and accessing an attention layer optimization feature vector, comprising the following steps:
step 21, converting the word vector matrix x1:lAnd word vector matrix w1:lRespectively inputting the two-way long and short term memory network for training, extracting the features by using the two-way long and short term memory network to obtain the sequence features of the text, improving the convergence of the network and obtaining the hidden layer state h of the word vector of the two-way long and short term memory networkwiHidden state h of sum word vectorxiA matrix x of word vectors to be converted1:lInputting the two-way long and short term memory network to train to obtain the hidden layer state h of the word vector of the two-way long and short term memory networkxiThe formula is expressed as:
ft=σ(wfx1:l+ufht-1+bf)
it=σ(wix1:l+uiht-1+bi)
ot=σ(wox1:l+uoht-1+bo)
Figure RE-FDA0002608966920000021
Figure RE-FDA0002608966920000022
hxt=otΘtanh(ct)
Figure RE-FDA0002608966920000023
Figure RE-FDA0002608966920000024
Figure RE-FDA0002608966920000025
wherein sigma is sigmoid activation function, and the output is [0,1 ]]And determining how much information can pass, wherein tanh is a hyperbolic tangent function, theta operation symbols represent matrix multiplication operation, and the gate f is forgottentDeciding to "forget" information that is not important in the back-propagation, input gate itDetermines the information to be updated
Figure RE-FDA00026089669200000211
Output gate otDetermining from the current cell state ctOutput to hidden layer state hxtThe content of (1). Current cell state ctThat is, the past cell state ct-1Merging with new memory, w(i)And u(i)Representing weights in the data processing process, a matrix w of word vectors to be converted1:lInputting the two-way long and short term memory network for training to obtain the hidden layer state h of the word vector of the two-way long and short term memory networkwiThe formula is expressed as:
ft=σ(wfw1:l+ufht-1+bf)
it=σ(wiw1:l+uiht-1+bi)
ot=σ(wow1:l+uoht-1+bo)
Figure RE-FDA0002608966920000026
Figure RE-FDA0002608966920000027
hwt=otΘtanh(ct)
Figure RE-FDA0002608966920000028
Figure RE-FDA0002608966920000029
Figure RE-FDA00026089669200000210
wherein sigma is sigmoid activation function, and the output is [0,1 ]]And determining how much information can pass, wherein tanh is a hyperbolic tangent function, theta operation symbols represent matrix multiplication operation, and the gate f is forgottentDeciding to "forget" information that is not important in the back-propagation, input gate itDetermines the information to be updated
Figure RE-FDA00026089669200000212
Output gate otDetermining from the current cell state ctOutput to hidden layer state hwtThe content of (1). Current cell state ctThat is, the past cell state ct-1Merging with new memory, w(i)And u(i)Representing weights in the data processing process;
step 22, the hidden layer state h of the word vector of the bidirectional long and short term memory network obtained in step 21 is usedwiHidden state h of sum word vectorxiFusing in a point-by-point manner; :
hi=[hwi·hxi]
step 23, hiding layer state h in the bidirectional long-short term memory networkiNonlinear transformation ui
ui=tanh(wwhi+bw)
Wherein, wwAnd bwRepresenting a weight matrix and a weight vector;
step 24, using softmax function to pair uiPerforming normalization operation to obtain attention matrix, i.e. output weight coefficient α of bidirectional long-short term memory networki
Figure RE-FDA0002608966920000031
Wherein u iswThe initialized weight matrix is shown;
step 25, output weight coefficient α of the bidirectional long and short term memory network layer obtained in step 24iAnd hidden layer state h obtained in step 22iMultiplying to obtain feature vector s extracted by bidirectional long-short term memory network layer with attention mechanisml
Figure RE-FDA0002608966920000032
Wherein, αiThe output weight coefficients are indicated.
4. The method for emotion analysis of text based on mixed model of word vector and word vector as claimed in claim 1, wherein in step 3, the trained word vector matrix x is used1:lAnd word vector matrix w1:lThe method is used as the input feature of a convolutional neural network, carries out convolution and pooling operations, learns the local feature of a text, and accesses an attention mechanism to acquire the deep feature, and comprises the following steps:
step 31, training the word vector matrix x1:lAnd word vector matrix w1:lRespectively inputting the input signals into a CNN network for training, and performing convolution operation by using a linear filter on an input matrix;
Cxi=f(W·x1:l+b)
Cwi=f(W·w1:l+b)
wherein, CxiRepresenting the word vector characteristics, C, of the word vector after the convolution operationwiThe character of the word vector obtained after the convolution operation is shown, b ∈ R shows an offset vector, W shows a convolution kernel with the height h being 3, 4, 5 and the width d being 128, f shows a nonlinear activation function, and a ReLu function is used as the activation function, which is expressed as:
f(x)=max(0,x)
step 32, for the trained word vector matrix x1:lAnd word vector matrix w1:lAfter convolution operation, a word vector characteristic diagram C is obtainedxSum word vector feature map Cw
Cx=[Cx1,Cx2,…,Cxl]
Cw=[Cw1,Cw2,…,Cwl]
Combining the local features extracted by the convolution kernels, and selecting 128 convolution kernels to obtain a plurality of feature maps representing different feature information for extracting more text features;
step 33, after completing the operation of step 32, matching the word vector feature map CxSum word vector feature map CwPerforming maximal pooling operation to obtain word vector inputGo out of characteristic cxiSum word vector output feature cwiThe method can reduce the characteristic dimension of the image,
cxi=max(Cx)
cwi=max(Cw)
then the fusion layer outputs the word vector to the feature cxiSum word vector output feature cwiThe point-by-point fusion is used,
ci=[cxi·cwi]
step 34, using tanh function to compare the characteristic c obtained in step 33iNonlinear transformation uci
uci=tanh(wwci+bw)
Wherein, wwAnd bwRepresenting the weight matrix and weight vector, and then using the Softmax function to pair uciNormalization is carried out to obtain an output weight coefficient α of the CNN layerci
Figure RE-FDA0002608966920000041
Wherein u iscwThe initialized weight matrix is shown;
step 35, outputting the weight coefficient α of the convolutional neural network layer obtained in the step 34ciWith the feature c obtained in step 33iMultiplying to obtain text features extracted after the convolutional neural network passes through the attention layer, and expressing the text features as a vector sc
Figure RE-FDA0002608966920000042
Wherein, αciThe output weight coefficients are indicated.
5. The method for analyzing emotion of text based on mixed model of word vector and word vector as claimed in claim 1, wherein in step 4, the features s extracted from the convolutional neural network layer with attention mechanism introducedcAnd introduction ofFeature vector s extracted by bidirectional long-short term memory network layer of attention mechanismlFusing, inputting a softmax classification layer for classification, positively setting the classification to be 1 and negatively setting the classification to be 0, and comparing and calculating the classification with a text label to obtain the text classification accuracy, wherein the method comprises the following steps:
step 41, extracting features s of the convolutional neural network layer with attention mechanismcAnd feature vectors s extracted by a bidirectional long-short term memory network layer introducing an attention mechanismlInputting the data into a full connection layer by using a point-by-point fusion mode to obtain output characteristics;
x=[sl·sc]
step 42, using a Dropout strategy, randomly selecting a part of the model to temporarily discard the part of the model from the network during model training, and not participating in parameter updating operation any more, and setting the Dropout rate to be 0.5, namely half of neurons in each iteration do not participate in calculation;
step 43, taking the feature x obtained in step 41 as an input of the classification layer, and calculating the probability size p of each text belonging to different categories by using a softmax function, which can be described as the following formula:
Figure RE-FDA0002608966920000051
where the text is divided into 2 categories, wkAnd bkIs the weight and bias of the layer;
and 44, judging the text type, judging that the probability value p belongs to a larger type, positively being 1, and negatively being 0, and comparing the probability value p with the text label to calculate to obtain the text accuracy.
CN202010379545.3A 2020-05-08 2020-05-08 Text emotion analysis method based on word vector and word vector mixed model Pending CN111651593A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010379545.3A CN111651593A (en) 2020-05-08 2020-05-08 Text emotion analysis method based on word vector and word vector mixed model

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010379545.3A CN111651593A (en) 2020-05-08 2020-05-08 Text emotion analysis method based on word vector and word vector mixed model

Publications (1)

Publication Number Publication Date
CN111651593A true CN111651593A (en) 2020-09-11

Family

ID=72344335

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010379545.3A Pending CN111651593A (en) 2020-05-08 2020-05-08 Text emotion analysis method based on word vector and word vector mixed model

Country Status (1)

Country Link
CN (1) CN111651593A (en)

Cited By (17)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112269874A (en) * 2020-10-10 2021-01-26 北京物资学院 Text classification method and system
CN112364638A (en) * 2020-10-13 2021-02-12 北京工业大学 Personality identification method based on social text
CN112559741A (en) * 2020-12-03 2021-03-26 苏州热工研究院有限公司 Nuclear power equipment defect recording text classification method, system, medium and electronic equipment
CN112561474A (en) * 2020-12-14 2021-03-26 华南理工大学 Intelligent personality characteristic evaluation method based on multi-source data fusion
CN112597311A (en) * 2020-12-28 2021-04-02 东方红卫星移动通信有限公司 Terminal information classification method and system based on low-earth-orbit satellite communication
CN112765353A (en) * 2021-01-22 2021-05-07 重庆邮电大学 Scientific research text-based biomedical subject classification method and device
CN112860905A (en) * 2021-04-08 2021-05-28 深圳壹账通智能科技有限公司 Text information extraction method, device and equipment and readable storage medium
CN113239354A (en) * 2021-04-30 2021-08-10 武汉科技大学 Malicious code detection method and system based on recurrent neural network
CN113326374A (en) * 2021-05-25 2021-08-31 成都信息工程大学 Short text emotion classification method and system based on feature enhancement
CN113342971A (en) * 2021-05-20 2021-09-03 王丽亚 Chinese text emotion analysis method based on fusion of multiple text features
CN113435192A (en) * 2021-06-15 2021-09-24 王丽亚 Chinese text emotion analysis method based on changing neural network channel cardinality
CN113704430A (en) * 2021-08-31 2021-11-26 平安普惠企业管理有限公司 Intelligent auxiliary receiving method and device, electronic equipment and storage medium
WO2022141861A1 (en) * 2020-12-31 2022-07-07 平安科技(深圳)有限公司 Emotion classification method and apparatus, electronic device, and storage medium
CN115878804A (en) * 2022-12-28 2023-03-31 郑州轻工业大学 E-commerce comment multi-classification emotion analysis method based on AB-CNN model
CN115934951A (en) * 2023-02-16 2023-04-07 湖南大学 Network hot topic user emotion prediction method
CN116740476A (en) * 2023-08-15 2023-09-12 四川互慧软件有限公司 Automatic human body labeling method based on patient 360 visualization
CN117251785A (en) * 2023-11-14 2023-12-19 天科大(天津)科技园有限责任公司 Multi-mode emotion analysis and emotion recognition method and system based on multi-task learning

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108763216A (en) * 2018-06-01 2018-11-06 河南理工大学 A kind of text emotion analysis method based on Chinese data collection
CN109145304A (en) * 2018-09-07 2019-01-04 中山大学 A kind of Chinese Opinion element sentiment analysis method based on word
CN109299262A (en) * 2018-10-09 2019-02-01 中山大学 A kind of text implication relation recognition methods for merging more granular informations
CN109299268A (en) * 2018-10-24 2019-02-01 河南理工大学 A kind of text emotion analysis method based on dual channel model
CN109492108A (en) * 2018-11-22 2019-03-19 上海唯识律简信息科技有限公司 Multi-level fusion Document Classification Method and system based on deep learning
CN110083833A (en) * 2019-04-18 2019-08-02 东华大学 Term vector joint insertion sentiment analysis method in terms of Chinese words vector sum
CN110532549A (en) * 2019-08-13 2019-12-03 青岛理工大学 A kind of text emotion analysis method based on binary channels deep learning model

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108763216A (en) * 2018-06-01 2018-11-06 河南理工大学 A kind of text emotion analysis method based on Chinese data collection
CN109145304A (en) * 2018-09-07 2019-01-04 中山大学 A kind of Chinese Opinion element sentiment analysis method based on word
CN109299262A (en) * 2018-10-09 2019-02-01 中山大学 A kind of text implication relation recognition methods for merging more granular informations
CN109299268A (en) * 2018-10-24 2019-02-01 河南理工大学 A kind of text emotion analysis method based on dual channel model
CN109492108A (en) * 2018-11-22 2019-03-19 上海唯识律简信息科技有限公司 Multi-level fusion Document Classification Method and system based on deep learning
CN110083833A (en) * 2019-04-18 2019-08-02 东华大学 Term vector joint insertion sentiment analysis method in terms of Chinese words vector sum
CN110532549A (en) * 2019-08-13 2019-12-03 青岛理工大学 A kind of text emotion analysis method based on binary channels deep learning model

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
胡可奇: "基于深度学习的短文本分类研究", 《中国优秀硕士学位论文全文数据库信息科技辑》, 15 October 2018 (2018-10-15), pages 138 - 1015 *

Cited By (26)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112269874A (en) * 2020-10-10 2021-01-26 北京物资学院 Text classification method and system
CN112364638A (en) * 2020-10-13 2021-02-12 北京工业大学 Personality identification method based on social text
CN112364638B (en) * 2020-10-13 2022-08-30 北京工业大学 Personality identification method based on social text
CN112559741A (en) * 2020-12-03 2021-03-26 苏州热工研究院有限公司 Nuclear power equipment defect recording text classification method, system, medium and electronic equipment
CN112559741B (en) * 2020-12-03 2023-12-29 苏州热工研究院有限公司 Nuclear power equipment defect record text classification method, system, medium and electronic equipment
CN112561474A (en) * 2020-12-14 2021-03-26 华南理工大学 Intelligent personality characteristic evaluation method based on multi-source data fusion
CN112561474B (en) * 2020-12-14 2024-04-30 华南理工大学 Intelligent personality characteristic evaluation method based on multi-source data fusion
CN112597311A (en) * 2020-12-28 2021-04-02 东方红卫星移动通信有限公司 Terminal information classification method and system based on low-earth-orbit satellite communication
CN112597311B (en) * 2020-12-28 2023-07-11 东方红卫星移动通信有限公司 Terminal information classification method and system based on low-orbit satellite communication
WO2022141861A1 (en) * 2020-12-31 2022-07-07 平安科技(深圳)有限公司 Emotion classification method and apparatus, electronic device, and storage medium
CN112765353A (en) * 2021-01-22 2021-05-07 重庆邮电大学 Scientific research text-based biomedical subject classification method and device
CN112765353B (en) * 2021-01-22 2022-11-04 重庆邮电大学 Scientific research text-based biomedical subject classification method and device
CN112860905A (en) * 2021-04-08 2021-05-28 深圳壹账通智能科技有限公司 Text information extraction method, device and equipment and readable storage medium
CN113239354A (en) * 2021-04-30 2021-08-10 武汉科技大学 Malicious code detection method and system based on recurrent neural network
CN113342971B (en) * 2021-05-20 2024-03-08 王丽亚 Chinese text emotion analysis method based on fusion of multiple text features
CN113342971A (en) * 2021-05-20 2021-09-03 王丽亚 Chinese text emotion analysis method based on fusion of multiple text features
CN113326374A (en) * 2021-05-25 2021-08-31 成都信息工程大学 Short text emotion classification method and system based on feature enhancement
CN113326374B (en) * 2021-05-25 2022-12-20 成都信息工程大学 Short text emotion classification method and system based on feature enhancement
CN113435192A (en) * 2021-06-15 2021-09-24 王丽亚 Chinese text emotion analysis method based on changing neural network channel cardinality
CN113704430A (en) * 2021-08-31 2021-11-26 平安普惠企业管理有限公司 Intelligent auxiliary receiving method and device, electronic equipment and storage medium
CN115878804A (en) * 2022-12-28 2023-03-31 郑州轻工业大学 E-commerce comment multi-classification emotion analysis method based on AB-CNN model
CN115878804B (en) * 2022-12-28 2023-06-20 郑州轻工业大学 E-commerce evaluation multi-classification emotion analysis method based on AB-CNN model
CN115934951A (en) * 2023-02-16 2023-04-07 湖南大学 Network hot topic user emotion prediction method
CN116740476B (en) * 2023-08-15 2023-11-07 四川互慧软件有限公司 Automatic human body labeling method based on patient 360 visualization
CN116740476A (en) * 2023-08-15 2023-09-12 四川互慧软件有限公司 Automatic human body labeling method based on patient 360 visualization
CN117251785A (en) * 2023-11-14 2023-12-19 天科大(天津)科技园有限责任公司 Multi-mode emotion analysis and emotion recognition method and system based on multi-task learning

Similar Documents

Publication Publication Date Title
CN111651593A (en) Text emotion analysis method based on word vector and word vector mixed model
CN110609891B (en) Visual dialog generation method based on context awareness graph neural network
CN111126386B (en) Sequence domain adaptation method based on countermeasure learning in scene text recognition
CN108763326B (en) Emotion analysis model construction method of convolutional neural network based on feature diversification
CN110083833B (en) Method for analyzing emotion by jointly embedding Chinese word vector and aspect word vector
CN110569508A (en) Method and system for classifying emotional tendencies by fusing part-of-speech and self-attention mechanism
Wei et al. A target-guided neural memory model for stance detection in twitter
CN111339281B (en) Answer selection method for reading comprehension choice questions with multi-view fusion
CN111522956A (en) Text emotion classification method based on double channels and hierarchical attention network
CN109522548A (en) A kind of text emotion analysis method based on two-way interactive neural network
CN110807084A (en) Attention mechanism-based patent term relationship extraction method for Bi-LSTM and keyword strategy
CN111160037A (en) Fine-grained emotion analysis method supporting cross-language migration
CN110415071B (en) Automobile competitive product comparison method based on viewpoint mining analysis
CN110427458B (en) Social network bilingual five-classification emotion analysis method based on double-gate LSTM
CN107818080A (en) Term recognition methods and device
CN112287106A (en) Online comment emotion classification method based on dual-channel hybrid neural network
CN111428481A (en) Entity relation extraction method based on deep learning
CN113723083A (en) Weighted negative supervision text emotion analysis method based on BERT model
CN110297986A (en) A kind of Sentiment orientation analysis method of hot microblog topic
CN115630156A (en) Mongolian emotion analysis method and system fusing Prompt and SRU
CN115906816A (en) Text emotion analysis method of two-channel Attention model based on Bert
CN114416969A (en) LSTM-CNN online comment sentiment classification method and system based on background enhancement
CN117668292A (en) Cross-modal sensitive information identification method
Ermatita et al. Sentiment Analysis of COVID-19 using Multimodal Fusion Neural Networks.
CN113378826B (en) Data processing method, device, equipment and storage medium

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
WD01 Invention patent application deemed withdrawn after publication

Application publication date: 20200911

WD01 Invention patent application deemed withdrawn after publication