CN117708692A - Entity emotion analysis method and system based on double-channel graph convolution neural network - Google Patents
Entity emotion analysis method and system based on double-channel graph convolution neural network Download PDFInfo
- Publication number
- CN117708692A CN117708692A CN202311415606.7A CN202311415606A CN117708692A CN 117708692 A CN117708692 A CN 117708692A CN 202311415606 A CN202311415606 A CN 202311415606A CN 117708692 A CN117708692 A CN 117708692A
- Authority
- CN
- China
- Prior art keywords
- grammar
- neural network
- representation
- hidden state
- channel
- 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
Links
- 230000008451 emotion Effects 0.000 title claims abstract description 87
- 238000004458 analytical method Methods 0.000 title claims abstract description 46
- 238000013528 artificial neural network Methods 0.000 title claims description 33
- 238000013527 convolutional neural network Methods 0.000 claims abstract description 51
- 239000011159 matrix material Substances 0.000 claims description 57
- 238000000034 method Methods 0.000 claims description 46
- 230000004927 fusion Effects 0.000 claims description 29
- 230000006870 function Effects 0.000 claims description 28
- 238000012549 training Methods 0.000 claims description 28
- 230000001419 dependent effect Effects 0.000 claims description 26
- 239000013598 vector Substances 0.000 claims description 21
- 230000007246 mechanism Effects 0.000 claims description 12
- 230000008569 process Effects 0.000 claims description 12
- 230000000873 masking effect Effects 0.000 claims description 11
- 238000010276 construction Methods 0.000 claims description 10
- 230000006698 induction Effects 0.000 claims description 9
- 230000004913 activation Effects 0.000 claims description 6
- 238000010606 normalization Methods 0.000 claims description 6
- 239000000411 inducer Substances 0.000 claims description 5
- 230000003044 adaptive effect Effects 0.000 claims description 4
- 230000009466 transformation Effects 0.000 claims description 4
- 102000002274 Matrix Metalloproteinases Human genes 0.000 claims description 3
- 108010000684 Matrix Metalloproteinases Proteins 0.000 claims description 3
- 238000006243 chemical reaction Methods 0.000 claims description 3
- 238000011478 gradient descent method Methods 0.000 claims description 3
- 230000001939 inductive effect Effects 0.000 claims description 3
- 238000012545 processing Methods 0.000 claims description 3
- 230000002194 synthesizing effect Effects 0.000 claims description 3
- 238000004804 winding Methods 0.000 claims description 3
- 238000012512 characterization method Methods 0.000 claims description 2
- 238000013507 mapping Methods 0.000 claims description 2
- 238000013135 deep learning Methods 0.000 abstract description 2
- 238000010586 diagram Methods 0.000 description 6
- 230000007935 neutral effect Effects 0.000 description 3
- 230000001427 coherent effect Effects 0.000 description 2
- 230000003993 interaction Effects 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 230000011218 segmentation Effects 0.000 description 2
- 230000003068 static effect Effects 0.000 description 2
- 230000009286 beneficial effect Effects 0.000 description 1
- 238000004364 calculation method Methods 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 230000006872 improvement Effects 0.000 description 1
- 238000011160 research Methods 0.000 description 1
- 238000012360 testing method Methods 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F18/00—Pattern recognition
- G06F18/20—Analysing
- G06F18/24—Classification techniques
- G06F18/241—Classification techniques relating to the classification model, e.g. parametric or non-parametric approaches
- G06F18/2415—Classification techniques relating to the classification model, e.g. parametric or non-parametric approaches based on parametric or probabilistic models, e.g. based on likelihood ratio or false acceptance rate versus a false rejection rate
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F18/00—Pattern recognition
- G06F18/20—Analysing
- G06F18/25—Fusion techniques
- G06F18/253—Fusion techniques of extracted features
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/04—Architecture, e.g. interconnection topology
- G06N3/042—Knowledge-based neural networks; Logical representations of neural networks
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/04—Architecture, e.g. interconnection topology
- G06N3/045—Combinations of networks
- G06N3/0455—Auto-encoder networks; Encoder-decoder networks
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/04—Architecture, e.g. interconnection topology
- G06N3/0464—Convolutional networks [CNN, ConvNet]
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/08—Learning methods
- G06N3/084—Backpropagation, e.g. using gradient descent
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
- Y02D10/00—Energy efficient computing, e.g. low power processors, power management or thermal management
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- Data Mining & Analysis (AREA)
- Evolutionary Computation (AREA)
- Life Sciences & Earth Sciences (AREA)
- Artificial Intelligence (AREA)
- General Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- Computing Systems (AREA)
- Software Systems (AREA)
- Molecular Biology (AREA)
- Computational Linguistics (AREA)
- Biophysics (AREA)
- Biomedical Technology (AREA)
- Mathematical Physics (AREA)
- General Health & Medical Sciences (AREA)
- Health & Medical Sciences (AREA)
- Bioinformatics & Cheminformatics (AREA)
- Bioinformatics & Computational Biology (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Evolutionary Biology (AREA)
- Probability & Statistics with Applications (AREA)
- Machine Translation (AREA)
Abstract
The invention provides an entity emotion analysis method and system based on a double-channel graph convolutional neural network, which relate to the technical field of deep learning and emotion analysis.
Description
Technical Field
The invention relates to the technical field of deep learning and emotion analysis, in particular to an entity emotion analysis method and system based on a dual-channel graph convolution neural network.
Background
Emotion analysis aims to identify and understand emotion and opinion expressed in human language, and is used to analyze a large amount of text data such as e-mail, blogs, social media, etc., so as to obtain mindset and feedback about products, services, brands, etc. of people. Emotion analysis is typically the analysis of a piece of text to determine whether the emotion expressed therein is positive, negative or neutral. The emotion analysis at both chapter level and sentence level does not know exactly what the emotion polarity of the user is for a specific thing. Such as "i like this cell phone". "this sentence contains positive emotion, but is far from sufficient for practical application. And the mobile phone has good photographing function, but has a ugly appearance. The emotion tendency of the user to the mobile phone is difficult to judge by simply understanding the sentence from the whole sentence. Because the "photographing function" is positive, the "appearance" is negative. In order to analyze the results more accurately, a fine-grained emotion analysis method is used.
As an important fine-grained emotion analysis problem, aspect-based emotion analysis refers to finding individual entity aspects in a text comment, and determining emotion information expressed by each entity aspect, and analyzing and understanding human intent from the aspect level, the key of this task is to find information between an aspect word and its corresponding perspective word. Considering that one comment sentence may contain a plurality of aspect words and viewpoint words, how to establish the relation between the aspect words and the viewpoint words corresponding to the aspect words is always a difficult problem of fine-grained emotion analysis, and considering that different comment sentences contain different expression modes, some comment sentences have the characteristic of regular sentence structure, and how to divide different aspect word and viewpoint word pairs by utilizing the characteristic is a subject with research significance.
At present, the construction of the connection between each aspect word and its corresponding viewpoint word can be roughly divided into three ideas. The first is to construct a relation between the two using a static dependency tree, which represents the grammatical relation between words in a sentence, and a complete tree structure is usually represented using an adjacency matrix, which has the disadvantage that the dependency tree parsed by the parser has a certain probability of being wrong and it is not the most advantageous for the task; the second is to capture the relationship between the two using an attention mechanism, which is commonly referred to as a multi-headed attention mechanism, which is based on passing the input language sequence through three linear transformation layersGet query representation +.>Key representation->Value means +.>Then, a similarity value, namely the attention score, among the words is obtained through a similarity calculation formula, and the disadvantage is that noise information irrelevant to viewpoint words is focused by using an attention mechanism, so that the accuracy of emotion analysis results is low; the third is an implicit dependency tree oriented to task induction, the induced hidden tree can be better adapted to the task, and the distance between the aspect words and the viewpoint words can be closer, and the disadvantage is that sentence structures of different comment sentences cannot be understood, semantic information of a whole sentence cannot be understood, and emotion analysis accuracy is low.
Disclosure of Invention
In order to solve the problem of low accuracy of the current emotion analysis method, the invention provides an entity emotion analysis method and system based on a double-channel graph convolutional neural network, which adopts the double-channel graph convolutional neural network to learn complex interactions among words in comment sentences, so that the accuracy of emotion analysis is improved.
In order to solve the problems, the technical scheme adopted by the application is as follows:
in a first aspect, the present invention provides a physical emotion analysis method based on a two-channel graph convolutional neural network, including the following steps:
inputting the natural language comment sequence into a pre-training language model encoder to obtain a comment sequence hidden state representation;
constructing a semantic graph convolution neural network with sentence structure consciousness to understand sentence structures of different comment sentences, and taking comment sequence hidden states as input to obtain semantic single-channel hidden state representation;
constructing a grammar graph convolutional neural network based on hidden tree induction to adapt to expressing complex comment sentences, and taking the hidden states of the comment sequences as input to obtain grammar single-channel hidden state representation;
constructing a self-adaptive feature fusion module, and fusing the semantic single-channel hidden state representation and the grammar single-channel hidden state representation to obtain a fused hidden state representation;
introducing a classifier, and generating emotion polarity prediction probability of each entity according to the fusion hidden state representation;
constructing a loss function according to emotion real labels and emotion polarity prediction probabilities of each entity, and training a model formed by a semantic graph convolutional neural network, a grammar graph convolutional neural network, a self-adaptive feature fusion module and a classifier to obtain a trained model so as to carry out entity emotion analysis.
Preferably, a natural language comment sequence is set as a given oneNA sequence of individual words, expressed as:the terms in the sequence are expressed as: />Wherein->Start word representing aspect, < >>An end word representing an aspect;
constructing an encoder-based sentence-aspect pairAs input to a pre-trained language model encoder, wherein +.>Tag representing semantic information encoded to get a whole sentence,>a tag representing a separate sentence and aspect word,i=1,2,...,N,t=1,2,...,mprocessing by a pre-training language model encoder to obtain comment sequence hidden state representation +.>,/>Is an n x d feature matrix, < >>,/>∈,/>Represent the firstiContextual representation of individual words.
Preferably, in constructing a semantic graph convolutional neural network with sentence structure awareness, a dynamic local attention mechanism guided by a supervisory paragraph signal is introduced to learn potential segment structures in sentences, and a soft mask matrix is first trained to generate word level attention spans for each sentenceThe left boundary position and the right boundary position of the masking vector are approximated by using a pointing mechanism, and the training process is specifically as follows: given query keyQAnd keyKWherein, the method comprises the steps of, wherein,Q=K= ,respectively calculating inquiry keysQLeft boundary matrix>And right boundary matrix->,;
Wherein,、/>、/>、/>winding up trainable parameters in a neural network for semantic graphs, +.>The dimensions of the masking vector are represented,Mmask matrix representing that the lower triangle elements are all 1 and the remaining elements are all minus infinityTo ensure the positioniLeft border position generated here->And right boundary position->The method meets the following conditions: />;
By synthesizing left boundary matricesAnd right boundary matrix->Get paragraph aware attention soft mask matrix +.>The expression is:
wherein,an upper triangular matrix representing a unit value of 1;
the self-attention score a is:
A=
soft masking of self-attention score A with paragraph-aware attention matrixIn combination, focusing on the influence of semantically related words and noise-eliminating words around the target position:
wherein the method comprises the steps ofRepresenting self-attention score A and mask matrix +.>The attention matrix obtained after the multiplication,representing attention matrix->Hidden state representation with comment sequence->Characterization obtained after multiplication by linear transformation.
Preferably, attention moment array is described by binary cross entropy lossAnd paragraph tag->The difference between:
wherein,meaning that the i-th word and the j-th word in the sentence are in the same paragraph, ++>Representing attention matrix->And paragraph tag->A cross entropy loss function between; />Representing a binary cross entropy loss operation;
at the moment of attentionThen, the neural network coding is rolled by using the semantic graph:
wherein,and->Representing trainable model parameters, +.>Representing a nonlinear activation function +.>Representing the semantic graph convolutional neural network +.>Layer text hidden state input representation,>representing the semantic graph convolutional neural network +.>The hidden state output representation of the layer text is obtained after convolution operation。
By the technical means, under the condition of lack of a supervision signal, the dynamic local attention may not pay attention to the context semantic information around the target aspect word, and the segmentation signal is further introduced to guide the learning of the dynamic local attention so as to capture the coherent semantic information more accurately.
Preferably, syntax-dependent tag information is first obtainedSaid syntax dependent tag information +_>Based on the obtained dependency tree by the analysis of the analyzer, mapping each different grammar dependency label into corresponding ID number to construct a grammar dependency label dictionary->Syntax-dependent tag information->And grammar dependent tag dictionary->The following respectively satisfy:
}
wherein,representing the first of sentencesiIndividual word and the firstjThe individual words are directly connected in the dependency tree,representing dependency tag information->The function of (1) is to convert the syntax-dependent tag into an ID number;
based on grammar-dependent tag dictionary, grammar-dependent tag informationEach dependency of->Vector embedded in a high dimension>The node-to-node relationship is then represented as an adjacency matrixWherein->Refers to->Personal word and->Dependent tag embedding vector between words, wheniIndividual word and the firstjWhen the words are not connected by edges, the word is +.>A "0" embedded vector is assigned.
Through the technical means, grammar-dependent tag information is implicitly added, and the method is self-adaptive to comment sentences with different sentence structures, so that the relation between aspect words and viewpoint words is better established.
Preferably, a weight matrix is calculated by a multi-head self-attention mechanism:
Wherein the method comprises the steps of, And->Is trainable parameter->Refers to the dimension of the vector;
adjacency matrix of relationshipsRConversion toGrammar relation weight matrix with same head number +.>Finally, weight matrix ++>Weight matrix related to grammar>Adding to obtain grammar enhanced weight matrix +.>:
Will beRegarding as an initial side weight matrix, inducing by using a hidden tree inducer to obtain a grammar-based potential tree having n nodes, each node representing each word in the input sentence, calculating +.>Non-normalized probability of individual node being selected as root node:a variant of the laplacian matrix of the syntax-enhanced latent tree is defined:
marginal probability of grammar-based potential treeThe method meets the following conditions:
adjacency matrix treated as a grammar-based potential tree, employing root constraint policy to point root node to aspect words, wherein +.>Means in the saphenous tree +.>Probability of individual words becoming root node, +.>E {0,1} represents }>Whether the individual word is an aspect word or not, the probability of leading the root node of the implicit dependency tree to point to the aspect word is maximum:
at the moment of attentionThereafter, the neural network is convolved with the grammar map for encoding:
wherein,and->Representing trainable parameters, ++>Representing a nonlinear activation function +.>Representation of the graph convolutional neural network +.>Layer text hidden state input representation,>representation of the graph convolutional neural network +.>Layer text hidden state output representation to obtain grammar single-channel hidden state representation +.>。
By the technical means, the initial side weight matrix is constructed, so that the tree inducer can be ensured to induce the grammar-based potential tree with n nodes.
Preferably, the adaptive feature fusion module comprises three channels, two channels in the three channels are obtained by expanding a transducer model, wherein an attention layer of the transducer model obtained by each expansion combines information from different data sources, and finally, grammar-guided semantic representation and grammar-guided grammar representation are obtained;
for a semantically guided grammar representation, Q represents the final output of the semantic channelK and V represent semantic guided grammar representation +.>:
Wherein,representing normalization layer operation, ++>Representing the resulting intermediate vector after passing through the normalization layer,a grammar representation that is directed for the final semantics;
semantic representation for grammar guidance:
wherein,a semantic representation guided for the final grammar;
the third channel concatenates the semantic single-channel hidden state representation and the syntactic single-channel hidden state representation,then through a feed forward networkExpressed as:
。
preferably, three channels are assigned different weights, given input characteristicsK is the number of channels, each channel score is:
wherein the method comprises the steps ofU=3, based on attention scoreAnd inputting the features to obtain a fusion hidden state representation +.>Expressed as:
。
through the technical means, information interaction between the semantic channels and the grammar channels can be effectively learned, and different functions among final outputs of different channels are considered, so that different weights are distributed to the final outputs of the three channels, and the model pays attention to important modules.
Preferably, the representation is based on a fused hidden stateUsing classifierssoftmaxGenerating emotion polarity prediction probabilities for each entitypExpression ofThe method comprises the following steps: />;
According to the true labelyAnd emotion polarity prediction probabilityp,Constructing a loss function:
then, byAnd training the model by using a gradient descent method as a loss function in the training process to obtain a trained model.
In a second aspect, the present invention further provides a fine granularity entity emotion analysis system based on a two-channel graph convolutional neural network, including:
the hidden state representation acquisition module is used for inputting the natural language comment sequence into the pre-training language model encoder to acquire a comment sequence hidden state representation;
the semantic graph convolution neural network construction module is used for constructing a semantic graph convolution neural network with sentence structure consciousness so as to understand the sentence structure of different comment sentences, and taking the hidden states of the comment sequences as input to obtain semantic single-channel hidden state representation;
the grammar graph convolution neural network construction module is used for constructing a grammar graph convolution neural network based on hidden tree induction so as to adapt to expressing complex comment sentences, and taking the hidden states of the comment sequences as input to obtain grammar single-channel hidden state representation;
the self-adaptive feature fusion module is used for constructing a self-adaptive feature fusion module, and fusing the semantic single-channel hidden state representation and the grammar single-channel hidden state representation to obtain a fused hidden state representation;
the classifier is used for generating emotion polarity prediction probability of each entity according to the fusion hidden state representation and outputting entity emotion analysis results;
the training module constructs a loss function according to the emotion real labels and emotion polarity prediction probabilities of each entity, trains a semantic graph convolutional neural network, a grammar graph convolutional neural network, a self-adaptive feature fusion module and a model formed by a classifier, and obtains a trained model.
Compared with the prior art, the technical scheme of the invention has the beneficial effects that:
the invention provides an entity emotion analysis method and system based on a double-channel graph convolutional neural network, wherein in the entity emotion analysis process, the purposes of understanding sentence structures of different comment sentences and adaptively expressing complex comment sentences are respectively realized by constructing a semantic graph convolutional neural network with sentence structure consciousness and a grammar graph convolution neural network based on hidden tree induction, semantic single-channel hidden state representation and grammar single-channel hidden state representation are obtained, then an adaptive feature fusion module is constructed, the semantic single-channel hidden state representation and the grammar single-channel hidden state representation are fused, and an integral model is trained to perform entity emotion analysis, so that fine granularity emotion analysis is realized, and the accuracy of emotion analysis results is improved.
Drawings
FIG. 1 shows a schematic flow chart of an entity emotion analysis method based on a two-channel graph convolution neural network according to an embodiment of the present invention;
FIG. 2 is a diagram showing the overall framework of fine-grained entity emotion analysis as proposed in an embodiment of the invention;
FIG. 3 shows a semantic graph convolutional neural network construction process diagram with sentence structure awareness proposed in an embodiment of the present invention;
FIG. 4 shows a schematic diagram of a neural network construction process based on a hidden-tree-induced grammar map according to an embodiment of the present invention;
FIG. 5 shows a block diagram of a fine-grained entity emotion analysis system based on a two-channel graph convolutional neural network according to an embodiment of the invention.
Detailed Description
The drawings are for illustrative purposes only and are not to be construed as limiting the present patent;
for better illustration of the present embodiment, some parts of the drawings may be omitted, enlarged or reduced, and do not represent actual dimensions;
it will be appreciated by those skilled in the art that some well known descriptions in the figures may be omitted.
The technical scheme of the invention is further described below with reference to the accompanying drawings and the examples;
the positional relationship depicted in the drawings is for illustrative purposes only and is not to be construed as limiting the present patent;
example 1
The embodiment provides an entity emotion analysis method based on a dual-channel graph convolution neural network, which is shown in fig. 1, and comprises the following steps:
s1: inputting the natural language comment sequence into a pre-training language model encoder to obtain a comment sequence hidden state representation;
s2, constructing a semantic graph convolution neural network with sentence structure consciousness to understand sentence structures of different comment sentences, and taking comment sequence hidden states as input to obtain semantic single-channel hidden state representation;
s3, constructing a grammar graph convolutional neural network based on hidden tree induction so as to adapt to expressing complex comment sentences, and taking the hidden states of the comment sequences as input to obtain grammar single-channel hidden state representation;
s4, constructing a self-adaptive feature fusion module, and fusing the semantic single-channel hidden state representation and the grammar single-channel hidden state representation to obtain a fused hidden state representation;
s5: introducing a classifier, and generating emotion polarity prediction probability of each entity according to the fusion hidden state representation;
s6, constructing a loss function according to emotion real labels and emotion polarity prediction probabilities of each entity, and training a model formed by a semantic graph convolutional neural network, a grammar graph convolutional neural network, a self-adaptive feature fusion module and a classifier to obtain a trained model so as to carry out entity emotion analysis.
In this embodiment, a specific fine-grained entity emotion analysis method with sequential implementation steps is provided, in other embodiments, the sequence of steps S2 and S3 is not fixedly limited, and based on the steps, the embodiment also provides the whole of fine-grained entity emotion analysis shown in fig. 2Frame diagram, whole, with a sentence of natural language sentence'The food is great but the service is dreafulBy taking an example, a natural language comment sequence is input into a pre-training language model encoder to obtain a comment sequence hidden state representation, then a semantic graph convolution neural network with sentence structure consciousness and a grammar graph convolution neural network based on hidden tree induction are constructed to respectively realize the purposes of understanding sentence structures of different comment sentences and adapting to express complicated comment sentences, the information of different channels is fused by self-adaptive fusion, and finally a trained model is obtained for emotion analysis by constructing a loss function between true emotion and predicted emotion and training the model.
In this embodiment, a natural language comment sequence is set as a given oneNA sequence of individual words, expressed as:the terms in the sequence are expressed as: />Wherein->Start word representing aspect, < >>An end word representing an aspect;
constructing an encoder-based sentence-aspect pairAs an input to the pre-training language model encoder, the pre-training language model encoder used in this embodiment is a Bert encoder, wherein,tag representing semantic information encoded to get a whole sentence,>a tag representing a separate sentence and aspect word,i=1,2,...,N,t=1,2,...,mprocessing by a pre-training language model encoder to obtain comment sequence hidden state representation +.>,/>Is an n x d feature matrix, < >>,/>∈/>,/>Represent the firstiContextual representation of individual words.
When a semantic graph convolutional neural network with sentence structure consciousness is constructed, a dynamic local attention mechanism guided by a supervision paragraph signal is introduced to learn potential segment structures in sentences, firstly, a soft masking matrix is trained to generate word level attention span of each sentence, a pointing mechanism is used for approximating left and right boundary positions of masking vectors, and the training process is specifically as follows: given query keyQAnd keyKWherein, the method comprises the steps of, wherein,Q=K= ,respectively calculating inquiry keysQLeft boundary matrix>And right boundary matrix->,;
Wherein,、/>、/>、/>winding up trainable parameters in a neural network for semantic graphs, +.>The dimensions of the masking vector are represented,Ma mask matrix representing that the lower triangle elements are all 1 and the rest elements are all minus infinity to ensure positioniLeft border position generated here->And right boundary position->The method meets the following conditions: />;
By synthesizing left boundary matricesAnd right boundary matrix->Get paragraph aware attention soft mask matrix +.>The expression is:
wherein,an upper triangular matrix representing a unit value of 1;
the self-attention score a is:
A=
soft masking of self-attention score A with paragraph-aware attention matrixIn combination, focusing on the influence of semantically related words and noise-eliminating words around the target position:
wherein the method comprises the steps ofRepresenting self-attention score A and mask matrix +.>The attention matrix obtained after the multiplication,representing attention matrix->Hidden state representation with comment sequence->The representation obtained after multiplication through linear transformation is based on the above process, and the whole semantic graph convolutional neural network construction process block diagram with sentence structure consciousness is shown in fig. 3.
In the present embodiment, considering that the dynamic local attention may not be focused on the contextual semantic information around the target aspect word in the absence of the supervisory signal, the segmentation signal is further introduced to guide the learning of the dynamic local attention so as to more accurately capture the coherent semantic information, in particular, the binary cross entropy loss is used for describing the attention moment arrayAnd paragraph tag->The difference between:
wherein,meaning that the i-th word and the j-th word in the sentence are in the same paragraph, ++>Representing attention matrix->And paragraph tag->A cross entropy loss function between; />Representing a binary cross entropy loss operation;
at the moment of attentionThen, the neural network coding is rolled by using the semantic graph:
wherein,and->Representing trainable model parameters, +.>Representing a nonlinear activation function +.>Representing the semantic graph convolutional neural network +.>Layer text hidden state input representation,>representing the semantic graph convolutional neural network +.>The hidden state output representation of the layer text is obtained after convolution operation。
The static dependency tree can be used for constructing the connection between each aspect word and the corresponding viewpoint word, the dependency tree can be obtained by analyzing by the existing analyzer, and grammar dependency label information can be further obtainedIn the present embodiment, the grammar is obtained firstDependent tag information->The grammar-dependent tag information is implicitly added, comment sentences with different sentence structures are adaptively established, the relation between aspect words and viewpoint words is better established, then each different grammar-dependent tag is mapped into a corresponding ID number, and a grammar-dependent tag dictionary is constructed>As shown in fig. 4, syntax-dependent tag information +.>And grammar dependent tag dictionary->The following respectively satisfy:
}
wherein,representing the first of sentencesiIndividual word and the firstjThe individual words are directly connected in the dependency tree,representing dependency tag information->The function of (1) is to convert the syntax-dependent tag into an ID number;
based on grammar-dependent tag dictionary, grammar-dependent tag informationEach dependency of->Vector embedded in a high dimension>The node-to-node relationship is then represented as an adjacency matrixWherein->Refers to->Personal word and->Dependent tag embedding vector between words, wheniIndividual word and the firstjWhen the words are not connected by edges, the word is +.>A "0" embedded vector is assigned.
To ensure that the hidden tree inducer induces a grammar-based potential tree with n nodes, a weight matrix is calculated by a multi-head self-attention mechanism:
Wherein the method comprises the steps of, And->Is trainable parameter->Refers to the dimension of the vector;
adjoining relationshipsMatrix arrayRConversion toGrammar relation weight matrix with same head number +.>Finally, weight matrix ++>Weight matrix related to grammar>Adding to obtain grammar enhanced weight matrix +.>:
Will beRegarding as an initial side weight matrix, inducing by using a hidden tree inducer to obtain a grammar-based potential tree having n nodes, each node representing each word in the input sentence, calculating +.>Non-normalized probability of individual node being selected as root node:a variant of the laplacian matrix of the syntax-enhanced latent tree is defined:
marginal probability of grammar-based potential treeThe method meets the following conditions:
adjacency matrix treated as a grammar-based potential tree, employing root constraint policy to point root node to aspect words, wherein +.>Means in the saphenous tree +.>Probability of individual words becoming root node, +.>E {0,1} represents }>Whether the individual word is an aspect word or not, the probability of leading the root node of the implicit dependency tree to point to the aspect word is maximum:
at the moment of attentionThereafter, the neural network is convolved with the grammar map for encoding:
wherein,and->Representing trainable parameters, ++>Representing a nonlinear activation function +.>Representation of the graph convolutional neural network +.>Layer text hidden state input representation,>representation of the graph convolutional neural network +.>Layer text hidden state output representation to obtain grammar single-channel hidden state representation +.>。
In this embodiment, the adaptive feature fusion module includes three channels, two channels in the three channels are obtained by expanding a transducer model, wherein an attention layer of the transducer model obtained by each expansion combines information from different data sources, and finally, a syntax-guided semantic representation and a syntax-guided syntax representation are obtained;
for a semantically guided grammar representation, Q represents the final output of the semantic channelK and V represent semantic guided grammar representation +.>:
Wherein,representing normalization layer operation, ++>Representing the intermediate vector obtained after normalization layer, < >>A grammar representation that is directed for the final semantics;
semantic representation for grammar guidance:
wherein,a semantic representation guided for the final grammar;
the third channel splices the semantic single-channel hidden state representation and the grammar single-channel hidden state representation, and then passes through a feedforward networkExpressed as:
。
the three channels are distributed with different weights so that the model pays attention to important modules, and given input characteristics are setK is the number of channels, each channel score being:
wherein the method comprises the steps ofU=3, based on attention scoreAnd inputting the features to obtain a fusion hidden state representation +.>Expressed as:
。
in this embodiment, the representation is based on a fused hidden stateUsing classifierssoftmaxGenerating emotion polarity prediction probabilities for each entitypThe expression is: />;
According to the true labelyAnd emotion polarity prediction probabilityp,Constructing a loss function:
setting the parameters of the model asTo->For learning rate, in->As a loss function in the training process, a gradient descent method is used for training a model, wherein the gradient is as follows:
;
the update process satisfies:
finally, a trained model is obtained and used for emotion analysis of the natural language comment sentences of the test set.
Example 2
As shown in fig. 5, this embodiment proposes a fine granularity entity emotion analysis system based on a two-channel graph convolutional neural network, including:
the hidden state representation acquisition module is used for inputting the natural language comment sequence into the pre-training language model encoder to acquire a comment sequence hidden state representation;
the semantic graph convolution neural network construction module is used for constructing a semantic graph convolution neural network with sentence structure consciousness so as to understand the sentence structure of different comment sentences, and taking the hidden states of the comment sequences as input to obtain semantic single-channel hidden state representation;
the grammar graph convolution neural network construction module is used for constructing a grammar graph convolution neural network based on hidden tree induction so as to adapt to expressing complex comment sentences, and taking the hidden states of the comment sequences as input to obtain grammar single-channel hidden state representation;
the self-adaptive feature fusion module is used for constructing a self-adaptive feature fusion module, and fusing the semantic single-channel hidden state representation and the grammar single-channel hidden state representation to obtain a fused hidden state representation;
the classifier is used for generating emotion polarity prediction probability of each entity according to the fusion hidden state representation and outputting entity emotion analysis results;
the training module constructs a loss function according to the emotion real labels and emotion polarity prediction probabilities of each entity, trains a semantic graph convolutional neural network, a grammar graph convolutional neural network, a self-adaptive feature fusion module and a model formed by a classifier, and obtains a trained model.
Example 3
In this embodiment, in order to verify the effectiveness of the method provided by the present invention, the accuracy and the F1 score are evaluated on the common data sets Laptop14, resuarts 14, twitter, and the experimental results are shown in table 1, where the row of "outer" indicates the accuracy and the F1 score of the method provided by the present invention, and it can be found that the accuracy and the F1 score of the method provided by the present invention are higher than the application effects of the existing model on the data sets Laptop14, resuarts 14, twitter, and reach the optimal performance on multiple data sets.
TABLE 1
Table 2 shows the emotion analysis results of the proposed method compared with the existing "DualGCN" model and the "SSEGCN" model on different sentences, as shown in Table 2, in the first sentence, the proposed method and the existing "DualGCN" model and the "SSEGCN" model can be accurately judged, but in the second sentence, the obvious "negative" emotion tendency and the existing "DualGCN" model and the "SSEGCN" model are both judged to be "neutral", are wrong, in the third sentence, the pure "negative" emotion tendency and the existing "SSEGCN" model are both judged to be "neutral", in the last sentence, the proposed method faces to complex and both the "negative" emotion tendency and the "positive" emotion tendency, and the existing "DualGCN" model and the "SSEGCN" model can not be accurately judged, and the proposed method can be accurately judged in many cases.
TABLE 2
It is to be understood that the above examples of the present invention are provided by way of illustration only and are not intended to limit the scope of the invention. Other variations or modifications of the above teachings will be apparent to those of ordinary skill in the art. It is not necessary here nor is it exhaustive of all embodiments. Any modification, equivalent replacement, improvement, etc. which come within the spirit and principles of the invention are desired to be protected by the following claims.
Claims (10)
1. The entity emotion analysis method based on the double-channel graph convolutional neural network is characterized by comprising the following steps of:
inputting the natural language comment sequence into a pre-training language model encoder to obtain a comment sequence hidden state representation;
constructing a semantic graph convolution neural network with sentence structure consciousness to understand sentence structures of different comment sentences, and taking comment sequence hidden states as input to obtain semantic single-channel hidden state representation;
constructing a grammar graph convolutional neural network based on hidden tree induction to adapt to expressing complex comment sentences, and taking the hidden states of the comment sequences as input to obtain grammar single-channel hidden state representation;
constructing a self-adaptive feature fusion module, and fusing the semantic single-channel hidden state representation and the grammar single-channel hidden state representation to obtain a fused hidden state representation;
introducing a classifier, and generating emotion polarity prediction probability of each entity according to the fusion hidden state representation;
constructing a loss function according to emotion real labels and emotion polarity prediction probabilities of each entity, and training a model formed by a semantic graph convolutional neural network, a grammar graph convolutional neural network, a self-adaptive feature fusion module and a classifier to obtain a trained model so as to carry out entity emotion analysis.
2. The method for analyzing physical emotion based on dual-channel graph convolutional neural network as recited in claim 1, wherein natural language comment sequence is set as a given oneNA sequence of individual words, expressed as:the terms in the sequence are expressed as: />Wherein->Start word representing aspect, < >>An end word representing an aspect;
constructing an encoder-based sentence-aspect pairAs input to a pre-trained language model encoder, wherein +.>Tag representing semantic information encoded to get a whole sentence,>a tag representing a separate sentence and aspect word,i=1,2,...,N,t=1,2,...,mprocessing by a pre-training language model encoder to obtain comment sequence hidden state representation +.>,/>Is an n x d feature matrix, < >>,/>∈/>,Represent the firstiContextual representation of individual words.
3. The method for analyzing entity emotion based on a two-channel graph convolutional neural network according to claim 2, wherein when a semantic graph convolutional neural network with sentence structure consciousness is constructed, a dynamic local attention mechanism is introduced to learn potential segment structures in sentences, firstly, a soft masking matrix is trained to generate word level attention span of each sentence, a pointing mechanism is used to approximate left and right boundary positions of masking vectors, and the training process is specifically as follows: given query keyQAnd keyKWherein, the method comprises the steps of, wherein,Q=K= ,respectively calculating inquiry keysQLeft boundary matrix>And right boundary matrix->,/>;
Wherein,、/>、/>、/>winding up trainable parameters in a neural network for semantic graphs, +.>The dimensions of the masking vector are represented,Ma mask matrix representing that the lower triangle elements are all 1 and the rest elements are all minus infinity to ensure positioniLeft border position generated here->And right boundary position->The method meets the following conditions: />;
By synthesizing left boundary matricesAnd right boundary matrix->Get paragraph aware attention soft mask matrix +.>The expression is:
wherein,an upper triangular matrix representing a unit value of 1;
the self-attention score a is:
A=
soft masking of self-attention score A with paragraph-aware attention matrixIn combination, focusing on the influence of semantically related words and noise-eliminating words around the target position:
wherein the method comprises the steps ofRepresenting self-attention score A and mask matrix +.>Attention matrix obtained after multiplication, +.>Representing attention matrix->Hidden state representation with comment sequence->Characterization obtained after multiplication by linear transformation.
4. The method for analyzing physical emotion based on dual-channel graph convolutional neural network as recited in claim 3, wherein the paragraph label is set asDescribing the attention matrix by means of binary cross entropy loss>And paragraph tag->The difference between:
wherein,meaning that the i-th word and the j-th word in the sentence are in the same paragraph, ++>Representing an attention matrixAnd paragraph tag->Cross entropy loss function between->Representing a binary cross entropy loss operation;
at the moment of attentionThen, the neural network coding is rolled by using the semantic graph:
wherein,and->Representing trainable model parameters, +.>Representing a nonlinear activation function +.>Representing the semantic graph convolutional neural network +.>Layer text hidden state input representation,>representing the semantic graph convolutional neural network +.>The hidden state output representation of the layer text is obtained after convolution operation。
5. The method for analyzing entity emotion based on dual-channel graph convolutional neural network as recited in claim 2, wherein grammar-dependent tag information is obtained firstSaid syntax dependent tag information +_>Based on the obtained dependency tree by the analysis of the analyzer, mapping each different grammar dependency label into corresponding ID number to construct a grammar dependency label dictionary->Syntax-dependent tag information->And grammar dependent tag dictionary->The following respectively satisfy:
}
wherein,representing the first of sentencesiIndividual word and the firstjThe individual words are directly connected in the dependency tree, +.>Representing dependency tag information->The function of (1) is to convert the syntax-dependent tag into an ID number;
based on grammar-dependent tag dictionary, grammar-dependent tag informationEach dependency of->Vector embedded in a high dimension>The node-to-node relationship is then represented as an adjacency matrix>Wherein->Refers to->Personal word and->Dependent tag embedding vector between words, wheniIndividual word and the firstjWhen the words are not connected by edges, the word is +.>A "0" embedded vector is assigned.
6. The method for analyzing entity emotion based on dual-channel graph convolutional neural network of claim 5, wherein a weight matrix is calculated by multi-head self-attention mechanism:
Wherein,and->Is trainable parameter->Refers to the dimension of the vector;
adjacency matrix of relationshipsRConversion toGrammar relation weight matrix with same head number +.>Finally, the weight matrixWeight matrix related to grammar>Adding to obtain grammar enhanced weight matrix +.>:
Will beRegarding as an initial side weight matrix, inducing by using a hidden tree inducer to obtain a grammar-based potential tree having n nodes, each node representing each word in the input sentence, calculating +.>Non-normalized probability of individual node being selected as root node:a variant of the laplacian matrix of the syntax-enhanced latent tree is defined:
marginal probability of grammar-based potential treeThe method meets the following conditions:
adjacency matrix treated as a grammar-based potential tree, employing root constraint policy to point root node to aspect words, wherein +.>Means in the saphenous tree +.>Probability of individual words becoming root node, +.>E {0,1} represents }>Whether the individual word is an aspect word or not, the probability of leading the root node of the implicit dependency tree to point to the aspect word is maximum:
at the moment of attentionThereafter, the neural network is convolved with the grammar map for encoding:
wherein,and->Representing trainable parameters, ++>Representing a nonlinear activation function +.>Representation of the graph convolutional neural networkLayer text hidden state input representation,>representation of the graph convolutional neural network +.>Layer text hidden state output representation to obtain grammar single-channel hidden state representation +.>。
7. The method for analyzing entity emotion based on a dual-channel graph convolutional neural network according to claim 1, wherein the adaptive feature fusion module comprises three channels, two channels in the three channels are obtained by expanding a transducer model, wherein an attention layer of each expanded transducer model combines information from different data sources, and finally, grammar-guided semantic representation and grammar-guided semantic representation are obtained;
for a semantically guided grammar representation, Q represents the final output of the semantic channelK and V represent semantic guided grammar representation +.>:
Wherein,representing normalization layer operation, ++>Representing the intermediate vector obtained after normalization layer, < >>A grammar representation that is directed for the final semantics;
semantic representation for grammar guidance:
wherein,a semantic representation guided for the final grammar;
the third channel splices the semantic single-channel hidden state representation and the grammar single-channel hidden state representation, and then passes through a feedforward networkExpressed as:
。
8. the method for analyzing entity emotion based on dual-channel graph convolutional neural network as recited in claim 7, wherein three channels are assigned different weights, and a given input characteristic is set as,UFor the number of channels, each channel score is:
wherein the method comprises the steps ofU=3, based on attention scoreAnd inputting the features to obtain a fusion hidden state representation +.>Expressed as:
。
9. the method for analyzing entity emotion based on dual-channel graph convolutional neural network of claim 8, wherein the hidden state is represented according to fusionUsing classifierssoftmaxGenerating emotion polarity prediction probabilities for each entitypThe expression is: />;
According to the true labelyAnd emotion polarity prediction probabilityp,Constructing a loss function:
Then, byAnd training the model by using a gradient descent method as a loss function in the training process to obtain a trained model.
10. A fine granularity entity emotion analysis system based on a two-channel graph convolutional neural network is characterized by comprising:
the hidden state representation acquisition module is used for inputting the natural language comment sequence into the pre-training language model encoder to acquire a comment sequence hidden state representation;
the semantic graph convolution neural network construction module is used for constructing a semantic graph convolution neural network with sentence structure consciousness so as to understand the sentence structure of different comment sentences, and taking the hidden states of the comment sequences as input to obtain semantic single-channel hidden state representation;
the grammar graph convolution neural network construction module is used for constructing a grammar graph convolution neural network based on hidden tree induction so as to adapt to expressing complex comment sentences, and taking the hidden states of the comment sequences as input to obtain grammar single-channel hidden state representation;
the self-adaptive feature fusion module is used for constructing a self-adaptive feature fusion module, and fusing the semantic single-channel hidden state representation and the grammar single-channel hidden state representation to obtain a fused hidden state representation;
the classifier is used for generating emotion polarity prediction probability of each entity according to the fusion hidden state representation and outputting entity emotion analysis results;
the training module constructs a loss function according to the emotion real labels and emotion polarity prediction probabilities of each entity, trains a semantic graph convolutional neural network, a grammar graph convolutional neural network, a self-adaptive feature fusion module and a model formed by a classifier, and obtains a trained model.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202311415606.7A CN117708692A (en) | 2023-10-30 | 2023-10-30 | Entity emotion analysis method and system based on double-channel graph convolution neural network |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202311415606.7A CN117708692A (en) | 2023-10-30 | 2023-10-30 | Entity emotion analysis method and system based on double-channel graph convolution neural network |
Publications (1)
Publication Number | Publication Date |
---|---|
CN117708692A true CN117708692A (en) | 2024-03-15 |
Family
ID=90154032
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202311415606.7A Pending CN117708692A (en) | 2023-10-30 | 2023-10-30 | Entity emotion analysis method and system based on double-channel graph convolution neural network |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN117708692A (en) |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN118133844A (en) * | 2024-05-07 | 2024-06-04 | 浙江大学 | Assessment method and device for latent semantic recognition capability of large language model |
CN118333132A (en) * | 2024-06-13 | 2024-07-12 | 湘江实验室 | Emotion recognition model training method, emotion recognition method and related equipment |
CN118644869A (en) * | 2024-08-15 | 2024-09-13 | 贵州白山云科技股份有限公司 | Method and device for detecting interaction recognition intention based on dual-channel attention network |
-
2023
- 2023-10-30 CN CN202311415606.7A patent/CN117708692A/en active Pending
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN118133844A (en) * | 2024-05-07 | 2024-06-04 | 浙江大学 | Assessment method and device for latent semantic recognition capability of large language model |
CN118333132A (en) * | 2024-06-13 | 2024-07-12 | 湘江实验室 | Emotion recognition model training method, emotion recognition method and related equipment |
CN118644869A (en) * | 2024-08-15 | 2024-09-13 | 贵州白山云科技股份有限公司 | Method and device for detecting interaction recognition intention based on dual-channel attention network |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110134771B (en) | Implementation method of multi-attention-machine-based fusion network question-answering system | |
US11194972B1 (en) | Semantic sentiment analysis method fusing in-depth features and time sequence models | |
US20210124878A1 (en) | On-Device Projection Neural Networks for Natural Language Understanding | |
WO2021233112A1 (en) | Multimodal machine learning-based translation method, device, equipment, and storage medium | |
CN110782870A (en) | Speech synthesis method, speech synthesis device, electronic equipment and storage medium | |
CN113268609B (en) | Knowledge graph-based dialogue content recommendation method, device, equipment and medium | |
CN117708692A (en) | Entity emotion analysis method and system based on double-channel graph convolution neural network | |
CN110457718B (en) | Text generation method and device, computer equipment and storage medium | |
CN115964467A (en) | Visual situation fused rich semantic dialogue generation method | |
CN113987179A (en) | Knowledge enhancement and backtracking loss-based conversational emotion recognition network model, construction method, electronic device and storage medium | |
CN113901191A (en) | Question-answer model training method and device | |
CN114168707A (en) | Recommendation-oriented emotion type conversation method | |
CN112818698A (en) | Fine-grained user comment sentiment analysis method based on dual-channel model | |
CA3123387C (en) | Method and system for generating an intent classifier | |
CN109933773A (en) | A kind of multiple semantic sentence analysis system and method | |
WO2023231513A1 (en) | Conversation content generation method and apparatus, and storage medium and terminal | |
CN115455197A (en) | Dialogue relation extraction method integrating position perception refinement | |
CN115600582A (en) | Controllable text generation method based on pre-training language model | |
CN112560440B (en) | Syntax dependency method for aspect-level emotion analysis based on deep learning | |
CN112257432A (en) | Self-adaptive intention identification method and device and electronic equipment | |
CN116108856B (en) | Emotion recognition method and system based on long and short loop cognition and latent emotion display interaction | |
CN114239575B (en) | Statement analysis model construction method, statement analysis method, device, medium and computing equipment | |
CN116821306A (en) | Dialogue reply generation method and device, electronic equipment and storage medium | |
KR102717013B1 (en) | System and Method for Table Specialized Machine Reading Comprehension using Structured and Unstructured and Semi-Structured Information | |
CN113449517B (en) | Entity relationship extraction method based on BERT gated multi-window attention network 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 |