CN117171610B - Knowledge enhancement-based aspect emotion triplet extraction method and system - Google Patents

Knowledge enhancement-based aspect emotion triplet extraction method and system Download PDF

Info

Publication number
CN117171610B
CN117171610B CN202310973778.XA CN202310973778A CN117171610B CN 117171610 B CN117171610 B CN 117171610B CN 202310973778 A CN202310973778 A CN 202310973778A CN 117171610 B CN117171610 B CN 117171610B
Authority
CN
China
Prior art keywords
emotion
matrix
module
words
sentence
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202310973778.XA
Other languages
Chinese (zh)
Other versions
CN117171610A (en
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.)
Jiangnan University
Original Assignee
Jiangnan University
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 Jiangnan University filed Critical Jiangnan University
Priority to CN202310973778.XA priority Critical patent/CN117171610B/en
Publication of CN117171610A publication Critical patent/CN117171610A/en
Application granted granted Critical
Publication of CN117171610B publication Critical patent/CN117171610B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • YGENERAL 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
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE 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/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Machine Translation (AREA)

Abstract

The invention discloses an aspect emotion triple extraction method and system based on knowledge enhancement, and belongs to the technical field of natural language processing. The method integrates common sense knowledge into a graph convolution network, integrates rich grammar information and common sense information, and is favorable for learning context characteristics and emotion characteristics by a model. In addition, aiming at the problem that comment sentences are insensitive to grammar, the method and the device capture the semantically related words of each word in the sentences by using a self-attention mechanism based on orthogonal loss, which are more flexible than a syntactic structure, and the mechanism can adapt to comment sentences insensitive to grammar information. Experimental results show that compared with the existing baseline method, the model provided by the invention has better effect.

Description

Knowledge enhancement-based aspect emotion triplet extraction method and system
Technical Field
The invention relates to an aspect emotion triple extraction method and system based on knowledge enhancement, and belongs to the technical field of natural language processing.
Background
The Aspect emotion triplet Extraction task (ASPECT SENTIMENT TRIPLET Extraction, ASTE) is one of the important subtasks of Aspect-level emotion analysis (ABSA). The ASTE task aims to identify all aspect emotion triples from sentences, which consist of aspect words, opinion words and emotion polarities, wherein opinion words are views or attitudes describing the aspect words. The emotion information can be provided by the aspect emotion triples from three aspects of aspect words, opinion words and emotion polarities, so that the emotion information can be better mined, and the emotion triples have broad prospects in the fields of product improvement, service feedback, public opinion mastering, policy formulation and the like. From a business level, as online purchases become popular in social life, users can write comments on corresponding goods or services in an e-commerce platform, and the user comments greatly influence the consumption intent of potential users. In addition, for merchants, the mining of the emotion information implied by the user comments helps the merchants to track the feedback comments of the users, so that the market demands and consumer preferences are better known, the self service or product is improved, and the optimization of sales strategies and personalized commodity recommendation is facilitated. From the social aspect, through research and analysis of views, attitudes or emotions expressed by people aiming at various social events, government departments are helped to grasp and guide public opinion more quickly and correctly to know the emotion attitudes of people, so that various management policies of the society are adjusted and modified according to feedback of the people, and the method has important practical significance for better building society and promoting social stability. Therefore, ASTE tasks have important application value.
The ASTE task existing methods can be broadly divided into pipeline (pipeline) extraction methods and joint extraction methods. Peng et al (Peng H,Xu L,Bing L,et al.Knowing What,How and Why:A Near Complete Solution for Aspect-Based Sentiment Analysis[C].Proceedings of the AAAI Conference on Artificial Intelligence,2020,34(05):8600-8607.) first proposed the ASTE task and a two-stage pipeline method. In the first stage, the emotion polarity-aspect word pairs and opinion words are respectively identified by utilizing a sequence labeling method, and in the second stage, the effective aspect words and opinion words are paired, and finally, the triples are obtained through prediction. Mao et al (Mao Y,Shen Y,Yu C,et al.A Joint Training Dual-MRC Framework for Aspect Based Sentiment Analysis[C].Proceedings of the AAAI conference on artificial intelligence,2021,35(15):13543-13551.) converts the original problem into two machine-reading understanding (MACHINE READING Comprehension, MRC) tasks by designing a specific query: the first MRC model is used for inquiring the aspect words in the sentence, and the second MRC model predicts the corresponding opinion word-emotion polarity pairs. Chen et al (Chen S,Wang Y,Liu J,et al.Bidirectional Machine Reading Comprehension for Aspect Sentiment Triplet Extraction[C].Proceedings of the AAAI conference on artificial intelligence,2021,35(14):12666-12674.) converts ASTE tasks into a multi-round MRC task and proposes a two-way learning framework. Firstly, inquiring all aspect words and opinion words respectively; then pairing the aspect words and the viewpoint words; and finally, classifying to obtain emotion polarities, and generating an aspect emotion triplet.
Since the above pipeline fetch method breaks ASTE tasks into multiple sub-tasks of the ABSA, there is a tendency for error propagation between the different sub-tasks. Recent research efforts have therefore employed a combination of extraction. Xu et al (Xu L,Li H,Lu W,et al.Position-Aware Tagging for Aspect Sentiment Triplet Extraction[C].Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing,2020:2339-2349.) propose a model based on a location-aware labeling approach to jointly extract emotion triples. The method increases position and emotion polarity marks, and provides two marking schemes according to the characteristics of aspect words and opinion words. Although this method effectively reduces error propagation caused by pipes, the case of aspect words and opinion words composed of a plurality of words cannot be handled well. Xu et al (Xu L,Chia Y K,Bing L.Learning Span-Level Interactions for Aspect Sentiment Triplet Extraction[C].Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing,2021,1:4755-4766.) propose a segment-based model to solve the ASTE task by generating segments for all aspect and opinion words and predicting the emotion polarity of candidate aspect-opinion word pairs, but ignores the importance of common sense emotion information. Li et al (Li Y,Lin Y,Lin Y,et al.A span-sharing joint extraction framework for harvesting aspect sentiment triplets[J].Knowledge-Based Systems,2022,242:108366.) propose a fragment sharing federated extraction framework that introduces syntactic dependency information to enhance the semantic representation of fragments, but this work ignores common sense information. In summary, the accuracy of the existing aspect emotion triple extraction task is still affected by a plurality of factors.
Disclosure of Invention
In order to better improve the accuracy of extraction of the emotion triples in aspects, the invention introduces syntax-dependent knowledge and common sense emotion perception information into a model, and provides a knowledge enhancement-based extraction method and system of the emotion triples in aspects, wherein the technical scheme is as follows:
the first object of the present invention is to provide an aspect emotion triplet extraction method, including:
Step 1: given a sentence S l={w1,w2,…,wn comprising n words, adding a classification tag [ cls ] at the beginning of the input sentence S l, adding a separator [ sep ] at the end of said input sentence, and then inputting it into BERT, resulting in a hidden layer representation H l={h0,h1,…,hn, where H 0 represents the encoded representation of [ cls ];
step 2: constructing a graph convolution neural network integrating emotion and grammar information, and inputting the input sentence S l={w1,w2,…,wn into the graph convolution neural network to obtain a hidden layer state output U;
Step 3: based on the hidden layer representation H l={h0,h1,…,hn, capturing semantic relativity between words by using a self-attention mechanism based on orthogonal constraint to obtain a self-attention weight matrix M and a self-attention mechanism operation result Z;
Step 4: processing the self-attention weight matrix M by using an orthogonal loss function to ensure that the attention weight distribution of all words has orthogonality;
Step 5: based on the hidden layer representation H l={h0,h1,…,hn, hidden layer state output U and the self-attention mechanism operation result Z, calculating to obtain a fused sentence vector representation For the fusion sentence vector/>Enumerating and screening to obtain filtered fragments;
Step 6: and extracting the aspect emotion triples from the filtered fragments by using a multi-classifier.
Optionally, the process of constructing the graph convolution neural network fusing emotion and grammar information and obtaining the hidden layer state output of the graph convolution neural network in the step 2 includes:
Step 21: the method comprises the steps of obtaining a syntax dependency tree of an input sentence S l by using a Stanford-NLP tool, constructing a directed graph G= { V, E } for the syntax dependency tree to represent words and dependency relations thereof, wherein V is a set of word nodes in the graph, E is a set of edges in the graph, and obtaining an adjacency matrix A epsilon R n×n of the sentence:
Step 22: introducing common sense emotion information into the adjacent matrix A by SENTICNET to obtain an emotion matrix C epsilon R n×n:
Cij=SenticNet(wi)+SenticNet(wj) (2)
step 23: obtaining an enhanced adjacency matrix D epsilon R n×n for introducing common sense emotion information based on the emotion matrix C and the adjacency matrix A:
Dij=Cij+Aij (3)
Step 24: constructing a graph convolution neural network based on the enhanced adjacent matrix D introducing common sense emotion information to obtain hidden layer state output Wherein, for the ith node of the kth layer, the hidden state is expressed asThe update formula is:
Where W k is the weight matrix of the kth layer, b k is the bias vector, and RELU represents the activation function.
Optionally, the step3 includes:
Step 31: the calculations using the self-attention mechanism are as follows:
Q=WQHl (5)
K=WKHl (6)
V=WVHl (7)
wherein W Q、WK、WV is a learnable weight matrix;
Step 32: dot product calculation is carried out on the weight matrixes Q and K, scaling and Softmax normalization are carried out on the weight matrixes Q and K, and then an attention weight matrix M is obtained, as shown in a formula (8):
wherein d is the dimension of the word vector;
step 63: the final self-attention mechanism calculation result Z is calculated as shown in formula (9):
Z=MV (9)。
Optionally, the orthogonal loss function in the step 4 is as shown in formula (10):
Lo=||MTM-I||F (10)
Where I is an identity matrix, F represents the Frobenius norm, each off-diagonal element of M T M is a dot product of two attention weight vectors, minimizing the off-diagonal element will cause orthogonality between the corresponding attention weight vectors, and minimizing the off-diagonal element maintains the orthogonality of the attention weight matrix M.
Optionally, the step 5 includes:
Step 51: computing a fused sentence vector representation As shown in formula (11):
Step 52: for the fused sentence vector Enumerating all possible fragments, and then screening for valid fragments using a binary-classified fragment filter;
All m fragments of a given sentence are denoted s= { S 0,s1,…,sm }, where the expression of the p-th fragment is shown as follows:
Wherein, And/>Word feature representations representing start positions and end positions, respectively, E representing randomly initialized trainable vectors;
Step 53: a super parameter L S is set to define the maximum length of the segment, as shown in the following equation:
1≤start(p)≤end(p)≤n (13)
0≤end(p)-start(p)≤LS (14)
Step 54: taking as input the hidden states h 0 of s p and [ cls ], and outputting yes or no, as shown in the following formula:
P(yp|sp)=softmax(FFNN(sp:h0)) (15)
wherein FFNN is a feed forward neural network;
The loss function of the segment filter is shown in the following formula:
Optionally, the step 6 includes:
The filtered fragments are used as candidate aspect words or candidate opinion words, the combination of any pair of candidate fragments is regarded as the existence of potential emotion expression, and aspect emotion triples are extracted through a multi-classifier;
A candidate aspect-opinion pair (s p,sq) is classified as emotion polarity r, where r ε { Positive, neutral, negative }, the candidate segment pairs are first connected as an input, and then the emotion polarities are classified as follows:
Wherein, Is a trainable weight matrix,/>Is a bias vector, for an aspect emotion triplet (s p,sq, r), if the triplet's score/>Above a predefined threshold λ, the triplet will be considered an aspect emotion triplet, aspect words, opinion words and emotion polarities s p、sq and r, respectively;
The loss function L 2 of triplet extraction uses the predicted value And true value/>Cross entropy between:
the loss function of the joint training SKF model is shown as follows:
L=L1+L2+Lo (20)。
A second object of the present invention is to provide an aspect emotion triplet extraction system, including: the system comprises an input module, a Bert coding module, a graph convolution module for fusing grammar and emotion information, an orthogonal self-attention module, a fragment filtering module and an output module;
The input module, the Bert coding module, the orthogonal self-attention module, the fragment filtering module and the output module are sequentially connected; the output end of the input module and the output end of the Bert coding module are connected with the input end of the fragment filtering module through the graph convolution module for fusing grammar and emotion information; the output end of the Bert coding module is connected with the input end of the fragment filtering module;
The calculation process of the graph convolution module for fusing grammar and emotion information comprises the following steps:
Step 21: the method comprises the steps of obtaining a syntax dependency tree of an input sentence S l by using a Stanford-NLP tool, constructing a directed graph G= { V, E } for the syntax dependency tree to represent words and dependency relations thereof, wherein V is a set of word nodes in the graph, E is a set of edges in the graph, and obtaining an adjacency matrix A epsilon R n×n of the sentence:
Step 22: introducing common sense emotion information into the adjacent matrix A by SENTICNET to obtain an emotion matrix C epsilon R n×n:
Cij=SenticNet(wi)+SenticNet(wj) (2)
step 23: obtaining an enhanced adjacency matrix D epsilon R n×n for introducing common sense emotion information based on the emotion matrix C and the adjacency matrix A:
Dij=Cij+Aij (3)
Step 24: constructing a graph convolution neural network based on the enhanced adjacent matrix D introducing common sense emotion information to obtain hidden layer state output Wherein, for the ith node of the kth layer, the hidden state is expressed asThe update formula is:
Where W k is the weight matrix of the kth layer, b k is the bias vector, and RELU represents the activation function.
Optionally, the calculation process of the orthogonal self-attention module includes:
Step 31: the calculations using the self-attention mechanism are as follows:
Q=WQHl (5)
K=WKHl (6)
V=WVHl (7)
wherein W Q、WK、WV is a learnable weight matrix;
Step 32: dot product calculation is carried out on the weight matrixes Q and K, scaling and Softmax normalization are carried out on the weight matrixes Q and K, and then an attention weight matrix M is obtained, as shown in a formula (8):
wherein d is the dimension of the word vector;
step 63: the final self-attention mechanism calculation result Z is calculated as shown in formula (9):
Z=MV (9)。
Optionally, the calculation process of the segment filtering module includes:
Step 51: computing a fused sentence vector representation As shown in formula (11):
Step 52: for the fused sentence vector Enumerating all possible fragments, and then screening for valid fragments using a binary-classified fragment filter;
All m fragments of a given sentence are denoted s= { S 0,s1,…,sm }, where the expression of the p-th fragment is shown as follows:
Wherein, And/>Word feature representations representing start positions and end positions, respectively, E representing randomly initialized trainable vectors;
Step 53: a super parameter L S is set to define the maximum length of the segment, as shown in the following equation:
1≤start(p)≤end(p)≤n (13)
0≤end(p)-start(p)≤LS (14)
Step 54: taking as input the hidden states h 0 of s p and [ cls ], and outputting yes or no, as shown in the following formula:
P(yp|sp)=softmax(FFNN(sp:h0)) (15)
wherein FFNN is a feed forward neural network;
The loss function of the segment filter is shown in the following formula:
A third object of the present invention is to provide a computer readable storage medium storing computer executable instructions which when executed by a processor implement a method according to any of the above.
The invention has the beneficial effects that:
the method is beneficial to better learning the dependency relationship of emotion correlation among context words, aspect words and opinion words by introducing common sense emotion information and an orthogonal self-attention-based method into the aspect emotion triplet extraction method, can solve the problem of insensitivity of grammar of sentences, achieves higher accuracy of the model on aspect emotion triplet extraction, and is proved by experimental results to be respectively higher than the best comparison method by 1.27%, 2.17%, 0.15% and 2.47% on four data sets.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for the description of the embodiments will be briefly described below, and it is apparent that the drawings in the following description are only some embodiments of the present invention, and other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a flow chart of an emotion triplet extraction method of an aspect of the present invention.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the present invention more apparent, the embodiments of the present invention will be described in further detail with reference to the accompanying drawings.
Embodiment one:
The embodiment provides an aspect emotion triple extraction method, as shown in fig. 1, including:
Step 1: given a sentence S l={w1,w2,…,wn comprising n words, adding a classification tag [ cls ] at the beginning of the input sentence S l, adding a separator [ sep ] at the end of the input sentence, and then inputting it into BERT, resulting in a hidden layer representation H l={h0,h1,…,hn, where H 0 represents the encoded representation of [ cls ];
Step 2: constructing a graph convolution neural network integrating emotion and grammar information, inputting an input sentence S l={w1,w2,…,wn into the graph convolution neural network to obtain a hidden layer state output U;
Step 3: based on the hidden layer representation H l={h0,h1,…,hn, capturing semantic relativity between words by using a self-attention mechanism based on orthogonal constraint to obtain a self-attention weight matrix M and a self-attention mechanism operation result Z;
Step 4: processing the self-attention weight matrix M by using an orthogonal loss function to ensure that the attention weight distribution of all words has orthogonality;
step 5: based on hidden layer representation H l={h0,h1,…,hn, hidden layer state output U and self-attention mechanism operation result Z, fused sentence vector representation is obtained by calculation Enumerating and screening the fusion sentence vectors to obtain filtered fragments;
Step 6: and extracting the emotion triples in the aspect of the filtered fragments by using a multi-classifier.
Embodiment two:
The embodiment provides an aspect emotion triple extraction method based on knowledge enhancement, as shown in fig. 1, which comprises the following specific steps:
step 1: given a sentence S l={w1,w2,…,wn comprising n words, a special class label [ cls ] is added at the beginning of the input sentence S l, and a separator [ sep ] is added at the end of the sentence. This is then input into the BERT, resulting in a hidden layer representation H l={h0,h1,…,hn, where H 0 represents the encoded representation of [ cls ].
Step2: a syntax dependency tree of the input sentence is obtained using a Stanford-NLP tool. Then, a directed graph g= { V, E } is constructed for the syntactic dependency tree to represent the words and their dependencies, where V is the set of word nodes in the graph and E is the set of edges in the graph. Then, a adjacency matrix A epsilon R n×n of the sentence is obtained, as shown in formula (1):
step 3: common sense emotion information is introduced into the model.
External emotion information SenticNet(Cambria E,Li Y,Xing F Z,et al.SenticNet 6:Ensemble application of symbolic and subsymbolic AI for sentiment analysis[C].Proceedings of the 29th ACM international conference on information&knowledge management,2020:105-114.) relies on real-world related epitaxial and connotative information, including implicit semantics related to common sense concepts.
SENTICNET is a public emotion analysis resource, so that common sense emotion knowledge is integrated into a graph convolution network, which can promote the model to extract the dependency relationship of emotion correlation among context words, aspect words and opinion words and is helpful for the prediction of emotion polarity by the model. When a word has a strong positive emotion factor, the emotion score is trended to 1, and when a word has a strong negative emotion factor, the emotion score is trended to-1.
In this embodiment, rich common sense emotion information is introduced into the adjacency matrix by combining SENTICNET to obtain an emotion matrix C e R n×n, and the emotion matrix C e R is calculated as shown in formula (2):
Cij=SenticNet(wi)+SenticNet(wj) (2)
Step 4: the enhanced adjacency matrix D epsilon R n×n of the introduced common sense emotion information is calculated, as shown in a formula (3):
Dij=Cij+Aij (3)
step 5: constructing a graph convolution neural network to obtain hidden layer state output Wherein, for the ith node of the kth layer, its hidden state is expressed as/>The update is as shown in equation (4):
Where W k is the weight matrix of the kth layer, b k is the bias vector, and RELU represents the activation function.
Step 6: considering that the ASTE task part sentences from web online reviews are informal, the present embodiment proposes a self-attention mechanism (OSM) based on Orthogonal constraints to better capture semantic relatedness between words. The mechanism can more flexibly capture the semantically related words of each word in the sentence, and can adapt to network online comments insensitive to the grammar information.
Step 61: the calculations using the self-attention mechanism are as follows:
Q=WQHl (5)
K=WKHl (6)
V=WVHl (7)
where W Q、WK、WV is a learnable weight matrix.
Step 62: then, the dot product calculation is carried out on Q and K, scaling and Softmax normalization are carried out on the dot product calculation, and then the attention weight matrix M is obtained, as shown in a formula (8):
where d is the dimension of the word vector.
Step 63: the final self-attention mechanism calculation result Z is calculated as shown in formula (9):
Z=MV (9)
step 7: since the self-attention weight matrix can represent semantic relativity between words, if the attention of the words is dispersed in sentences, noisy words are easy to notice and noise is introduced, so that the scores of the attention weights are expected to be distributed in different areas of the sentences and should be overlapped as little as possible.
The present embodiment encourages orthogonality of the attention weight distributions of all words by introducing an orthogonal loss function, thereby better capturing semantic relatedness between aspect words, opinion words, and context words. Specifically, for the attention score matrix M, the orthogonal loss function is as shown in equation (10):
Lo=||MTM-I||F (10)
Where I is an identity matrix and F represents the Frobenius norm. Thus, each off-diagonal element of M T M is a dot product of two attention weight vectors, and minimizing the off-diagonal element will result in orthogonality between the corresponding attention weight vectors. Minimizing off-diagonal elements will preserve the orthogonality of the attention score matrix M.
Step 8: enumerating and filtering segment representations.
Step 81: computing a fused sentence vector representationAs shown in formula (11)
Step 82: the present embodiment enumerates all possible fragments and then uses a binary classified fragment filter to filter the valid fragments. Specifically, all m fragments of a given sentence are denoted s= { S 0,s1,…,sm }, where the expression of the p-th fragment is shown as follows:
Wherein, And/>The word feature representation representing the start position and the word feature representation of the end position, respectively, E represents a randomly initialized trainable vector.
Step 83: a super parameter L S is set to define the maximum length of the segment, as shown in the following equation:
1≤start(p)≤end(p)≤n (13)
0≤end(p)-start(p)≤LS (14)
Step 84: then, the hidden states h 0 of s p and [ cls ] are taken as input, and the output is yes or no, as shown in the following formula:
P(yp|sp)=softmax(FFNN(sp:h0)) (15)
wherein FFNN is a feed forward neural network. The loss function of the segment filter is shown in the following formula:
Step 9: the filtered segments may be used as candidate aspect words or candidate opinion words. The combination of any pair of candidate fragments is regarded as the existence of potential emotion expression, and the aspect emotion triples are extracted through a multi-classifier.
One candidate aspect-opinion pair (s p,sq) is classified as emotion polarity r, where r.epsilon.Positive, neutral, negative. Specifically, candidate segment pairs are first connected as an input and then classified for emotion polarity as shown in the following formula:
Wherein, Is a trainable weight matrix,/>Is the bias vector. For an aspect emotion triplet (s p,sq, r), if the triplet score/>Above a predefined threshold λ, the triplet will be considered an aspect emotion triplet, with aspect words, opinion words and emotion polarities s p、sq and r, respectively.
The loss function L 2 of triplet extraction uses the predicted valueAnd true value/>Cross entropy between:
the loss function of the joint training SKF model is shown as follows:
L=L1+L2+Lo (20)
embodiment III:
The present embodiment provides an aspect emotion triple extraction system for implementing the aspect emotion triple extraction method described in the first embodiment or the second embodiment, where the system of the present embodiment includes: the system comprises an input module, a Bert coding module, a graph convolution module for fusing grammar and emotion information, an orthogonal self-attention module, a fragment filtering module and an output module;
the input module, the Bert coding module, the orthogonal self-attention module, the fragment filtering module and the output module are sequentially connected; the output end of the input module and the output end of the Bert coding module are connected with the input end of the fragment filtering module through the graph convolution module for fusing grammar and emotion information; the output end of the Bert coding module is connected with the input end of the fragment filtering module.
The system of this embodiment functions as: for example, in The comment, "The food ALWAYS TASTES FRESH AND THE SERVICE IS sample", two triples are included in total: (food, fresh, positive) and (service, prot, positive), the purpose of this example is to extract both triples.
In order to further illustrate the beneficial effects that the invention can achieve, the following experiments were performed:
The following 9 baseline methods were used as comparison methods:
(1) CMLA +: the method uses a CMLA method based on a multi-layer attention network. The method is divided into two stages, namely, emotion polarity-aspect word pairs in sentences are extracted firstly, opinion words are extracted, and then aspect emotion triples are obtained by using a classifier based on a multi-layer perceptron.
(2) RINANTE +: according to the method, mining rules are fused in the first stage to capture the dependency relationship of words in sentences, and in the second stage, a classifier based on a multi-layer perceptron is used to obtain aspect emotion triples.
(3) Peng-two-stage: the method proposes a two-stage pipeline framework to solve ASTE tasks. In the first stage, the method extracts emotion polarity-aspect word pairs and opinion words through a sequence labeling method. And then in the second stage, pairing the aspect words and the opinion words, and finally predicting to obtain the triples.
(4) JET: the method provides a new position perception marking scheme for extracting emotion triples in an end-to-end joint mode. The method increases position and emotion polarity marks, and provides two marking schemes according to the characteristics of aspect words and opinion words.
(5) GTS: the method uses a unified new grid marking scheme to extract the emotion triples in the aspect end to end. Meanwhile, an effective reasoning strategy is designed, so that more accurate extraction of the emotion triples in the final aspect can be realized.
(6) Dual-MRC: the method builds two machine reading understanding problems and solves ASTE tasks by jointly training two machine reading understanding models with parameter sharing.
(7) B-MRC: the model formalizes ASTE tasks as a multi-round machine-reading understanding task. It extracts aspect words, viewpoint words and emotion polarities by designing three kinds of queries, respectively.
(8) Span-ASTE: the model provides a fragment-level extraction method for the emotion triples. The method considers the relation between aspect words and viewpoint words and provides a double-channel fragment pruning method.
(9) SSJE: the method provides a fragment sharing joint extraction framework to extract the emotion triples end to end. The method introduces syntax dependency information obtained by a graph convolution network into a model, and generates aspect emotion triples for candidate aspect words and candidate viewpoint words and local context at one time.
Tables 1 and 2 present the baseline method and the comparison of the F1 scores of the proposed method on the four public data sets 14Res, 14Lap, 15Res, 16Res data sets, with the correct, recall and F1 scores shown in tables 1 and 2, with the best results indicated in bold.
Table 1 shows the results of comparison of the correct rate P (%), recall rate R (%) and F1 score (%) on the 14Res and 14Lap datasets. * Is the result of implementing code reproduction using its release
Table 2 shows the results of comparison of the correct rate P (%), recall rate R (%) and F1 score (%) on the 15Res and 16Res datasets. * Is the result of implementing code reproduction using its release
From the experimental results, the following conclusions can be drawn. First, on four public datasets, the F1 score of the proposed method is superior to the other nine comparison methods, which demonstrates the effectiveness of the fragment-based knowledge enhancement method of the present invention in the ASTE tasks.
Compared to Span-ASTE, the F1 score of the method of the present invention is 1.27%, 2.17%, 0.15% and 2.47% higher on the four datasets, respectively, as the present invention introduces rich syntactic dependency information and external emotion knowledge.
In contrast to Span-ASTE, the method of the present invention builds a graph convolutional network before generating and filtering segments, which facilitates extraction of context emotion dependencies by the model.
The F1 scores of the SKF model were 1.93%, 2.35%, 0.68% and 1.77% higher, respectively, than the baseline method SSJE, since the method of the present invention introduced an orthogonalization-based self-attention method. Through a self-attention mechanism based on orthogonal loss, the invention can capture the semantically related words of each word in the sentence, and can also be helpful to the prediction effect of the sentence insensitive to grammar. In addition, compared with pipeline extraction methods such as Peng-two-stage, the SKF model can generate the emotion triples in one time, and error propagation can be well prevented.
Some steps in the embodiments of the present invention may be implemented by using software, and the corresponding software program may be stored in a readable storage medium, such as an optical disc or a hard disk.
The foregoing description of the preferred embodiments of the invention is not intended to limit the invention to the precise form disclosed, and any such modifications, equivalents, and alternatives falling within the spirit and scope of the invention are intended to be included within the scope of the invention.

Claims (5)

1. An aspect emotion triplet extraction method, which is characterized by comprising the following steps:
Step 1: given a sentence S l={w1,w2,…,wn comprising n words, adding a classification tag [ cls ] at the beginning of the input sentence S l, adding a separator [ sep ] at the end of said input sentence, and then inputting it into BERT, resulting in a hidden layer representation H l={h0,h1,…,hn, where H 0 represents the encoded representation of [ cls ];
step 2: constructing a graph convolution neural network integrating emotion and grammar information, and inputting the input sentence S l={w1,w2,…,wn into the graph convolution neural network to obtain a hidden layer state output U;
Step 3: based on the hidden layer representation H l={h0,h1,…,hn, capturing semantic relativity between words by using a self-attention mechanism based on orthogonal constraint to obtain a self-attention weight matrix M and a self-attention mechanism operation result Z;
Step 4: processing the self-attention weight matrix M by using an orthogonal loss function to ensure that the attention weight distribution of all words has orthogonality;
Step 5: based on the hidden layer representation H l={h0,h1,…,hn, hidden layer state output U and the self-attention mechanism operation result Z, calculating to obtain a fused sentence vector representation For the fusion sentence vector/>Enumerating and screening to obtain filtered fragments;
Step 6: extracting the emotion triples in the aspect of the filtered fragments by using a multi-classifier;
The step 2 of constructing a graph convolution neural network integrating emotion and grammar information and obtaining hidden layer state output thereof comprises the following steps:
Step 21: the method comprises the steps of obtaining a syntax dependency tree of an input sentence S l by using a Stanford-NLP tool, constructing a directed graph G= { V, E } for the syntax dependency tree to represent words and dependency relations thereof, wherein V is a set of word nodes in the graph, E is a set of edges in the graph, and obtaining an adjacency matrix A epsilon R n×n of the sentence:
Step 22: introducing common sense emotion information into the adjacent matrix A by SENTICNET to obtain an emotion matrix C epsilon R n×n:
Cij=SenticNet(wi)+SenticNet(wj) (2)
step 23: obtaining an enhanced adjacency matrix D epsilon R n×n for introducing common sense emotion information based on the emotion matrix C and the adjacency matrix A:
Dij=Cij+Aij (3)
Step 24: constructing a graph convolution neural network based on the enhanced adjacent matrix D introducing common sense emotion information to obtain hidden layer state output Wherein, for the ith node of the kth layer, its hidden state is expressed as/>The update formula is:
Wherein W k is the weight matrix of the kth layer, b k is the bias vector, and RELU represents the activation function;
The step 3 comprises the following steps:
Step 31: the calculations using the self-attention mechanism are as follows:
Q=WQHl (5)
K=WKHl (6)
V=WVHl (7)
wherein W Q、WK、WV is a learnable weight matrix;
Step 32: dot product calculation is carried out on the weight matrixes Q and K, scaling and Softmax normalization are carried out on the weight matrixes Q and K, and then an attention weight matrix M is obtained, as shown in a formula (8):
wherein d is the dimension of the word vector;
step 63: the final self-attention mechanism calculation result Z is calculated as shown in formula (9):
Z=MV (9)
the step 5 comprises the following steps:
Step 51: computing a fused sentence vector representation As shown in formula (11):
Step 52: for the fused sentence vector Enumerating all possible fragments, and then screening for valid fragments using a binary-classified fragment filter;
All m fragments of a given sentence are denoted s= { S 0,s1,…,sm }, where the expression of the p-th fragment is shown as follows:
Wherein, And/>Word feature representations representing start positions and end positions, respectively, E representing randomly initialized trainable vectors;
Step 53: a super parameter L S is set to define the maximum length of the segment, as shown in the following equation:
1≤start(p)≤end(p)≤n (13)
0≤end(p)-start(p)≤LS (14)
Step 54: taking as input the hidden states h 0 of s p and [ cls ], and outputting yes or no, as shown in the following formula:
P(yp|sp)=softmax(FFNN(sp:h0)) (15)
wherein FFNN is a feed forward neural network;
The loss function of the segment filter is shown in the following formula:
2. The method for extracting an emotion triplet according to claim 1, wherein the orthogonal loss function in step 4 is as shown in formula (10):
Lo=||MTM-I||F (10)
Where I is an identity matrix, F represents the Frobenius norm, each off-diagonal element of M T M is a dot product of two attention weight vectors, minimizing the off-diagonal element will cause orthogonality between the corresponding attention weight vectors, and minimizing the off-diagonal element maintains the orthogonality of the attention weight matrix M.
3. The method for extracting an emotion triplet according to claim 2, wherein said step 6 comprises:
The filtered fragments are used as candidate aspect words or candidate opinion words, the combination of any pair of candidate fragments is regarded as the existence of potential emotion expression, and aspect emotion triples are extracted through a multi-classifier;
A candidate aspect-opinion pair (s p,sq) is classified as emotion polarity r, where r ε { Positive, neutral, negative }, the candidate segment pairs are first connected as an input, and then the emotion polarities are classified as follows:
Wherein, Is a trainable weight matrix,/>Is a bias vector, for an aspect emotion triplet (s p,sq, r), if the triplet's score/>Above a predefined threshold λ, the triplet will be considered an aspect emotion triplet, aspect words, opinion words and emotion polarities s p、sq and r, respectively;
The loss function L 2 of triplet extraction uses the predicted value And true value/>Cross entropy between:
the loss function of the joint training SKF model is shown as follows:
L=L1+L2+Lo (20)。
4. An aspect emotion triplet extraction system, the system comprising: the system comprises an input module, a Bert coding module, a graph convolution module for fusing grammar and emotion information, an orthogonal self-attention module, a fragment filtering module and an output module;
The input module, the Bert coding module, the orthogonal self-attention module, the fragment filtering module and the output module are sequentially connected; the output end of the input module and the output end of the Bert coding module are connected with the input end of the fragment filtering module through the graph convolution module for fusing grammar and emotion information; the output end of the Bert coding module is connected with the input end of the fragment filtering module;
The calculation process of the graph convolution module for fusing grammar and emotion information comprises the following steps:
Step 21: the method comprises the steps of obtaining a syntax dependency tree of an input sentence S l by using a Stanford-NLP tool, constructing a directed graph G= { V, E } for the syntax dependency tree to represent words and dependency relations thereof, wherein V is a set of word nodes in the graph, E is a set of edges in the graph, and obtaining an adjacency matrix A epsilon R n×n of the sentence:
Step 22: introducing common sense emotion information into the adjacent matrix A by SENTICNET to obtain an emotion matrix C epsilon R n×n:
Cij=SenticNet(wi)+SenticNet(wj) (2)
step 23: obtaining an enhanced adjacency matrix D epsilon R n×n for introducing common sense emotion information based on the emotion matrix C and the adjacency matrix A:
Dij=Cij+Aij (3)
Step 24: constructing a graph convolution neural network based on the enhanced adjacent matrix D introducing common sense emotion information to obtain hidden layer state output Wherein, for the ith node of the kth layer, its hidden state is expressed as/>The update formula is:
Wherein W k is the weight matrix of the kth layer, b k is the bias vector, and RELU represents the activation function;
the calculation process of the orthogonal self-attention module comprises the following steps:
Step 31: the calculations using the self-attention mechanism are as follows:
Q=WQHl (5)
K=WKHl (6)
V=WVHl (7)
wherein W Q、WK、WV is a learnable weight matrix;
Step 32: dot product calculation is carried out on the weight matrixes Q and K, scaling and Softmax normalization are carried out on the weight matrixes Q and K, and then an attention weight matrix M is obtained, as shown in a formula (8):
wherein d is the dimension of the word vector;
step 63: the final self-attention mechanism calculation result Z is calculated as shown in formula (9):
Z=MV (9);
the calculation process of the fragment filtering module comprises the following steps:
Step 51: computing a fused sentence vector representation As shown in formula (11):
Step 52: for the fused sentence vector Enumerating all possible fragments, and then screening for valid fragments using a binary-classified fragment filter;
All m fragments of a given sentence are denoted s= { S 0,s1,…,sm }, where the expression of the p-th fragment is shown as follows:
Wherein, And/>Word feature representations representing start positions and end positions, respectively, E representing randomly initialized trainable vectors;
Step 53: a super parameter L S is set to define the maximum length of the segment, as shown in the following equation:
1≤start(p)≤end(p)≤n (13)
0≤end(p)-start(p)≤LS (14)
Step 54: taking as input the hidden states h 0 of s p and [ cls ], and outputting yes or no, as shown in the following formula:
P(yp|sp)=softmax(FFNN(sp:h0)) (15)
wherein FFNN is a feed forward neural network;
The loss function of the segment filter is shown in the following formula:
5. A computer readable storage medium storing computer executable instructions which when executed by a processor implement the method of any one of claims 1 to 3.
CN202310973778.XA 2023-08-03 2023-08-03 Knowledge enhancement-based aspect emotion triplet extraction method and system Active CN117171610B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310973778.XA CN117171610B (en) 2023-08-03 2023-08-03 Knowledge enhancement-based aspect emotion triplet extraction method and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310973778.XA CN117171610B (en) 2023-08-03 2023-08-03 Knowledge enhancement-based aspect emotion triplet extraction method and system

Publications (2)

Publication Number Publication Date
CN117171610A CN117171610A (en) 2023-12-05
CN117171610B true CN117171610B (en) 2024-05-03

Family

ID=88945886

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310973778.XA Active CN117171610B (en) 2023-08-03 2023-08-03 Knowledge enhancement-based aspect emotion triplet extraction method and system

Country Status (1)

Country Link
CN (1) CN117171610B (en)

Citations (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111582576A (en) * 2020-05-06 2020-08-25 西安交通大学 Prediction system and method based on multi-scale feature fusion and gate control unit
CN112528672A (en) * 2020-12-14 2021-03-19 北京邮电大学 Aspect-level emotion analysis method and device based on graph convolution neural network
CN112966074A (en) * 2021-05-17 2021-06-15 华南师范大学 Emotion analysis method and device, electronic equipment and storage medium
CN113743097A (en) * 2021-08-23 2021-12-03 桂林电子科技大学 Emotion triple extraction method based on span sharing and grammar dependency relationship enhancement
CN114942976A (en) * 2022-05-30 2022-08-26 北京邮电大学 Mask context machine reading understanding-based aspect emotion triple extraction method
CN115099219A (en) * 2022-07-06 2022-09-23 曲阜师范大学 Aspect level emotion analysis method based on enhancement graph convolutional neural network
CN115269847A (en) * 2022-08-02 2022-11-01 广西师范大学 Knowledge-enhanced syntactic heteromorphic graph-based aspect-level emotion classification method
CN115510226A (en) * 2022-09-02 2022-12-23 哈尔滨工业大学(深圳)(哈尔滨工业大学深圳科技创新研究院) Emotion classification method based on graph neural network
CN115905527A (en) * 2022-04-29 2023-04-04 重庆大学 Priori knowledge-based method for analyzing aspect-level emotion of BERT model
CN116402066A (en) * 2023-04-13 2023-07-07 重庆邮电大学 Attribute-level text emotion joint extraction method and system for multi-network feature fusion
CN116414988A (en) * 2023-04-19 2023-07-11 山东师范大学 Graph convolution aspect emotion classification method and system based on dependency relation enhancement
CN116415592A (en) * 2023-01-10 2023-07-11 华中科技大学 Aspect emotion triplet extraction method

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US11868730B2 (en) * 2020-09-23 2024-01-09 Jingdong Digits Technology Holding Co., Ltd. Method and system for aspect-level sentiment classification by graph diffusion transformer

Patent Citations (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111582576A (en) * 2020-05-06 2020-08-25 西安交通大学 Prediction system and method based on multi-scale feature fusion and gate control unit
CN112528672A (en) * 2020-12-14 2021-03-19 北京邮电大学 Aspect-level emotion analysis method and device based on graph convolution neural network
CN112966074A (en) * 2021-05-17 2021-06-15 华南师范大学 Emotion analysis method and device, electronic equipment and storage medium
CN113743097A (en) * 2021-08-23 2021-12-03 桂林电子科技大学 Emotion triple extraction method based on span sharing and grammar dependency relationship enhancement
CN115905527A (en) * 2022-04-29 2023-04-04 重庆大学 Priori knowledge-based method for analyzing aspect-level emotion of BERT model
CN114942976A (en) * 2022-05-30 2022-08-26 北京邮电大学 Mask context machine reading understanding-based aspect emotion triple extraction method
CN115099219A (en) * 2022-07-06 2022-09-23 曲阜师范大学 Aspect level emotion analysis method based on enhancement graph convolutional neural network
CN115269847A (en) * 2022-08-02 2022-11-01 广西师范大学 Knowledge-enhanced syntactic heteromorphic graph-based aspect-level emotion classification method
CN115510226A (en) * 2022-09-02 2022-12-23 哈尔滨工业大学(深圳)(哈尔滨工业大学深圳科技创新研究院) Emotion classification method based on graph neural network
CN116415592A (en) * 2023-01-10 2023-07-11 华中科技大学 Aspect emotion triplet extraction method
CN116402066A (en) * 2023-04-13 2023-07-07 重庆邮电大学 Attribute-level text emotion joint extraction method and system for multi-network feature fusion
CN116414988A (en) * 2023-04-19 2023-07-11 山东师范大学 Graph convolution aspect emotion classification method and system based on dependency relation enhancement

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
基于依存树增强注意力模型的方面级情感分析;张文轩等;《计算机应用研究》;20220127;第39卷(第6期);第1656-1662页 *
基于距离与图卷积网络的方面级情感分析;巫浩盛等;《计算机应用研究》;20210715;第38卷(第11期);第3274-3321页 *
面向用户在线评论的方面级情感分析方法研究;霍文静;《中国优秀硕士学位论文全文数据库 信息科技辑 (月刊)》;20230215(第02期);论文全文 *

Also Published As

Publication number Publication date
CN117171610A (en) 2023-12-05

Similar Documents

Publication Publication Date Title
Clark et al. Entity-centric coreference resolution with model stacking
Lin et al. Freedom: A transferable neural architecture for structured information extraction on web documents
Zhao et al. Graph convolutional network based on multi-head pooling for short text classification
Wu et al. Deep weighted maxsat for aspect-based opinion extraction
Geng et al. Explainable zero-shot learning via attentive graph convolutional network and knowledge graphs
He et al. A local and global context focus multilingual learning model for aspect-based sentiment analysis
Stengel-Eskin et al. Universal decompositional semantic parsing
Xu et al. BERT gated multi-window attention network for relation extraction
Wang et al. Self‐Information Loss Compensation Learning for Machine‐Generated Text Detection
Wu Commonsense knowledge powered heterogeneous graph attention networks for semi-supervised short text classification
CN113128667B (en) Cross-domain self-adaptive graph rolling balance migration learning method and system
Dai et al. Double embedding and bidirectional sentiment dependence detector for aspect sentiment triplet extraction
Li et al. Dual graph convolutional networks integrating affective knowledge and position information for aspect sentiment triplet extraction
Li et al. Lexical attention and aspect-oriented graph convolutional networks for aspect-based sentiment analysis
Gao et al. Chinese causal event extraction using causality‐associated graph neural network
Zhang et al. A contrastive learning framework with tree-LSTMs for aspect-based sentiment analysis
Günther et al. Retro: Relation retrofitting for in-database machine learning on textual data
CN112632223A (en) Case and event knowledge graph construction method and related equipment
CN117171610B (en) Knowledge enhancement-based aspect emotion triplet extraction method and system
CN116414988A (en) Graph convolution aspect emotion classification method and system based on dependency relation enhancement
Cao et al. Performance analysis of aspect-level sentiment classification task based on different deep learning models
Wei et al. Edge‐featured graph attention network with dependency features for causality detection of events
Tang [Retracted] Analysis of English Multitext Reading Comprehension Model Based on Deep Belief Neural Network
Wang et al. Learning Event Logic Graph Knowledge for Credit Risk Forecast.
Liu et al. Centre: A paragraph-level chinese dataset for relation extraction among enterprises

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
CB02 Change of applicant information
CB02 Change of applicant information

Country or region after: China

Address after: No. 1800 road 214122 Jiangsu Lihu Binhu District City of Wuxi Province

Applicant after: Jiangnan University

Address before: No. 1-2202-8, Financial 8th Street, Wuxi Economic Development Zone, Jiangsu Province, 214000

Applicant before: Jiangnan University

Country or region before: China

GR01 Patent grant
GR01 Patent grant