Next Article in Journal
Test–Retest Repeatability of Human Gestures in Manipulation Tasks
Previous Article in Journal
Research on the Vehicle Steering and Braking Stability Region
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Customer Sentiment Recognition in Conversation Based on Contextual Semantic and Affective Interaction Information

1
College of Economics and Management, China Three Gorges University, Yichang 443002, China
2
Economics and Management Department, Guangxi Minzu Normal University, Chongzuo 532200, China
3
College of Computer and Information Technology, China Three Gorges University, Yichang 443002, China
*
Author to whom correspondence should be addressed.
Appl. Sci. 2023, 13(13), 7807; https://doi.org/10.3390/app13137807
Submission received: 5 May 2023 / Revised: 18 June 2023 / Accepted: 30 June 2023 / Published: 2 July 2023

Abstract

:
In the e-commerce environment, conversations between customers and businesses contain a multitude of useful information about customer sentiment. By mining that information, customer sentiment can be validly identified, which is helpful in accurately identifying customer needs and improving customer satisfaction. Contextual semantics information and inter-speaker affective interaction information are two key factors for identifying customers’ sentiments in conversation. Unfortunately, none of the existing approaches consider the two factors simultaneously. In this paper, we propose a conversational sentiment analysis method based on contextual semantic and affective interaction information. The proposed approach uses different bidirectional gated recurrent unit (BiGRU) combined with attention mechanisms to encode the contextual semantic information of different types of conversational texts. For modeling affective interactions, we use directed graph structures to portray the affective interactions between speakers and encode them with affective interaction features using graph convolutional neural networks (GCN). Finally, the two features are afused to recognize customer sentiment. The experimental results on the JDDC dataset show that our model can more accurately recognize customer sentiment than other baseline models in customer service conversation.

1. Introduction

Recently, with the development of artificial intelligence, conversation systems are gradually moving toward practical application. Thereinto, customer service chatbot is widely used in online business environments, such as Amazon’s Alexa [1], JD.com’s JIMI [2], and Alibaba’s AliMe [3]. The customer service chatbot content usually comes from a corpus of web-based knowledge [4], which can answer accurately enough. But its emotional intelligence is still a short board. In this background, customer sentiment analysis is an important task in customer service conversation, which is a prerequisite for the dialogue system to generate empathetic reply content. In this study, we focus on customer sentiment recognition in conversation, which aims to assign a proper sentiment label to each utterance in a customer service conversation.
Recognizing customer sentiment in conversations is very dependent on the contextual semantic information of the conversation or the affective interaction information between the speakers [5,6]. Take the conversation in Figure 1 as an example, if only considering the sentiment of the current utterance, the third utterance expresses a neutral sentiment. However, the third utterance expresses a negative sentiment if considering the contextual information of the conversation, which is inferred by the fourth sentence, indicating that the customer complains about the long waiting time for delivery. Therefore, it is necessary to mine contextual semantic information, which can enhance, weaken, or reverse the original sentiment of the current utterance [7]. In addition, the affective tendency of the conversation is also reflected in the affective interaction between the speakers. For instance, customers express strong dissatisfaction (i.e., the sixth utterance) when they perceive the agent’s response as perfunctory (i.e., the fifth utterance). The agent provides a more positive response (i.e., the seventh utterance) after sensing a very negative customer sentiment. Thus, modeling the affective interaction information between speakers can improve the accuracy of the sentiment recognition model to a certain extent.
For the characteristics of customer service conversation, this paper proposes a conversational sentiment analysis model based on contextual semantics and affective interaction information, which fully exploits the value of contextual semantics and affective interaction information between speakers. Specifically, to extract the contextual semantic information, this paper uses different BiGRU networks to contextually encode the customer utterance text and agent utterance text. Then, the two are fused into the global dialogues to encode the global contexts and achieve a deep and refined mining of different context types. To realize the modeling of affective interaction information between speakers, we construct a directed graph structure to portray the affective interaction dependencies between interlocutors and use graph convolutional neural networks to extract the affective dependency interaction features between speakers and themselves and interlocutors.
This paper has three main contributions. Firstly, we propose a model that considers contextual semantics and affective interaction information between speakers to recognize customer sentiment in conversation, which can effectively use the relevant information of the utterance. Second, we propose a contextual semantic encoder and affective interaction encoder to capture different speakers’ contextual information and inter-speaker affective interaction information, respectively. Third, the experiment results demonstrate that the performance of our model is superior to the baseline models for a sentiment analysis of the JDDC dataset.

2. Related Work

Conversational sentiment analysis differs from sentence-level and chapter-level sentiment analysis in that it needs to consider the contextual background of the conversation and the affective interactions between different speakers [6,8]. Therefore, contextual relevance models and speaker relevance models are two entry points for conversational sentiment analysis. In addition, to improve the validity of the models, some scholars also assisted modeling with other information, such as sentiment congruence and conversation topic information.
Contextual correlation models [9] mainly use contextual information in conversations to help the model improve sentiment analysis. Poria et al. [9] proposed a cLSTM model that enables utterances to capture contextual information from their surroundings, which first trains a separate CNN model for the vector representation of all utterances in a conversation, then inputs the vector representation into the LSTM model to obtain the contextual association representation of the utterance and finally recognizes the utterance sentiment. Zhong et al. [10] proposed a knowledge-enriched transformer (KET) to effectively incorporate contextual information and external knowledge bases to identify sentiment, which uses self-attention and cross-attention modules to exploit contextual information more efficiently. Tang et al. [11] proposed a method about target-dependent sentiment classification, which mainly uses target-dependent long short-term memory to capture contextual information and model the relatedness of a target word with its context words. Basiri et al. [12] utilized two independent bidirectional LSTM and GRU layers to extract both past and future contexts by combining the forward and backward hidden layers, and used the attention mechanism to focus on important parts.
The speaker-related model [13] focuses on the speaker’s state and interactions while considering conversational contextual information. Hazarika et al. [13] proposed a CMN model, which stores the context information in memories and models the interplay of these memories to capture inter-speaker dependencies. The CMN model selected separate memory units for different speakers. Based on this model, Hazarika et al. [14] proposed an ICON model, which uses a unified memory unit, realizes separate textual representations of the historical discourse of different speakers using the SIM module, then globally integrates them through the DGIM module. Majumder et al. [15] proposed a DialogueRNN model, which uses three GRU networks (speaker state GRU, global state GRU, and sentiment state GRU) to capture speaker information, historical discourse, and sentiment information, respectively. Zhang et al. [16] propose a graph convolutional neural network-based model, ConGCN, which uses each speaker and their corresponding utterance representations as nodes in the graph and associates them through undirected edges. Ghosal et al. [17] also used graph convolutional neural networks to model conversations, but the difference is that the DialogueGCN model contains only utterance nodes and indirectly associates them with previous speakers by deciding the type of edges based on different speaker information.
Current research has shown that the approach of incorporating the speaker’s affective interaction or contextual information is an effective means to improve the accuracy of conversational sentiment recognition. Based on this, some scholars also assisted modeling with other information, such as sentiment consistency and conversation topic information, which can help to improve the accuracy of sentiment recognition. For sentiment consistency modeling, Wang et al. [18] transformed the conversation sentiment recognition task into a sequence-tagging task for sentiment consistency modeling, using a conditional random field model layer to learn the sentiment consistency in conversations. Gao et al. [19] proposed a multi-task learning model, which uses sentiment transfer detection as a secondary task to help achieve conversational sentiment recognition. Zhu et al. [20] proposed a conversation sentiment recognition method from the perspective of dialogue topic information modeling, which achieves conversation sentiment recognition by combining topic-enhanced information with a knowledge base of conversation contextual information.
Our model differs from the above in several ways. Firstly, we model from both contextual and affective interactions between speakers to further explore the information. Secondly, we encode the context information of different speakers and fuse this information into global context information, which can extract the context information more accurately.

3. Methods

The architecture of our model is shown in Figure 2, which consists of a conversation text encoder, context semantic encoder, affective interaction encoder, and sentiment classifier. Firstly, the conversation text encoder uses an ERNIE pre-trained model to obtain the high-dimensional feature representation of each utterance. Then, from the perspective of different speakers, the BiGRU network is used to encode the utterance representation separately to obtain the relevant context representation of the speaker. And then, we fuse the context representation of the different speakers and input it into the new BiGRU network to obtain the global contextual semantic information. Meanwhile, we construct a directed graph structure to characterize the affective interaction dependence between speakers and use GCN to encode the interactive dependence information between speakers and themselves and intermediates. Finally, the SoftMax classifier is applied to the fused feature of conversation context and affective interaction feature, which results in five sentiment classes, i.e., negative, very negative, neutral, positive, and very positive. The details of the proposed model are described in Section 3.1, Section 3.2, Section 3.3 and Section 3.4.

3.1. Conversation Text Encoder

The main function of the conversation text encoder is to obtain the utterance vector representation. In the field of NLP, converting text into a way that computers can understand is a fundamental task for every task. Existing studies have shown that the language representation model obtained by pre-training a large-scale corpus can improve the ability of the models to represent text features and enhance the performance of downstream NLP tasks [21].
To extract the utterance representations of conversation, our model employs the pre-trained ERNIE3.0 [22] model, which has 12 encoder layers, 768 hidden states, and 12 self-attention heads. Specifically, for input, the text   { x 1 , x 2 , , x m } is preprocessed by the ERNIE model into a word-based vector with 768 dimensions, and it is transformed into   { [ c l s ] , x 1 , x m , [ c l s ] } , where x i is the word at position i   in the utterance, and the first and last [ c l s ] mark the start and end positions of the utterance, respectively.
The ERNIE3.0 then computes the utterance representation, as shown in Equation (1):
u i A , u i B = E R N I E ( U i A , U i B )
where A and B represent different speakers, i.e., customer and agent, respectively; U i denotes the unencoded utterance; and u i denotes the encoded utterance at moment i . u i A and u i B denote the encoded utterances of speaker A and speaker B at moment i , respectively, which are encoded by ERNIE model.

3.2. Context Semantic Encoder

In customer service conversation scenarios, the sentiment of each utterance relates to the contextual information because of the continuity of the dialogue. Therefore, encoding contextual semantic information is critical for conversational sentiment analysis.
To obtain the contextual semantic information of the conversation, we use different BiGRU networks to extract different contextual semantic features and then use the attention mechanism to weigh contextual semantic features. Specifically, in the customer service conversation scenario, the conversation text is divided into two types according to different speaker identities, i.e., customer and agent conversation text. Then, we use different BiGRU networks to encode them. In addition, in order to model the contextual semantic association relationship between speakers, this paper inputs the contextual semantic features of the above two encodings into the new BiGRU network to obtain a global contextual semantic encoding representation. The calculation process is as follows:
g t   =   G R U ( g t 1 , u t )
g t = G R U ( g t 1 , u t )
g t = [ g t , g t ] , t = 1 , 2 , , K
where u t is the utterance representation after the ERNIE pre-model coding; g t and g t are the output vector results of the forward and backward GRU networks, respectively; and g t is the utterance representation that contains contextual semantic information.
In addition, considering the long-distance dependence between the semantics of the conversation context in the customer service conversation, and the inconsistency of the semantic contribution weight of the context utterances at different distances to the current utterance, we use the attention mechanism to weigh the contextual semantic information of different utterances. The specific details are shown in Figure 3.
Specifically, we use the BiGRU network to encode the utterance and obtain the vector representation, and then match it with the vector representation of other utterances to obtain the corresponding attention weights. The calculation process is as follows:
α t = s o f t m a x ( u t w α   [ g 1 , g 2 , , g t 1 ] )
s o f t m a x ( g ) = [ e g 1 i e g i , e g 2 i e g i , ]
where g 1 , g 2 , , g t 1 are the vector representations of utterances encoded by the BiGRU network; α t is the attention weight matrix; and w α is the parameter to be learned during training. The context vector representation c t related to the utterance g t is obtained by weighting the utterances to sum:
c t = α t   [ g 1 , g 2 , , g t 1 ] T
Finally, the context vector representation related to the utterance g t is input into the fully connected network to obtain a textual representation G t of the fused conversation context semantic information:
G t = R e L U ( W C ( g t c t ) + b c )
where ReLU is an activation function, represents the vector stitching operation, and W C and b c are the trainable model parameters.

3.3. Affective Interaction Encoder

The affective interaction encoder is mainly responsible for encoding the affective interaction relationship information between speakers in conversation. In this paper, we use directed graphs to characterize the affective interaction relationship between speakers and use GCN to extract the characteristics of affective interaction between speakers.
Specifically, we construct a directed graph G = ( V , E , R , W )  to characterize the dialogue interaction, V represents the set of nodes, and E represents the set of edges. Each utterance represents a vertex, v i V , i = [ 1 , 2 , , K ] , K is the number of utterances. The initialization vector of the vertex v i is an utterance representation that encodes the utterance through the ERNIE pre-training model. r i j E represents the edge relationship between pairs of utterance ( v i , v j ) , and r R represents the type of edge, which relates to dependencies between speakers.
This paper adopts the graph attention mechanism based on text similarity to set the weight of the edge, i.e., for each node, the sum of the weights of the input edges is 1. Considering the m sentences v i 1 , v i 2 , …, v i m before each node utterance and the n sentences v i + 1 , v i + 2 , …, v i + n after each node utterance, the weight calculation between the node v i and the node v j is shown in Equation (9):
i j = s o f t m a x ( g t T W [ g i m , , g i + n ] ) , s = i m , , i + n
where i j is the attention weight between a node and neighboring nodes and W is the parameter to be learned during training.
In customer service conversations, speakers are affected by each other’s emotions. Therefore, we construct the affective interaction-directed graph by constructing different types of edge relations. For customer service conversation, the edge relationship is shown in Table 1.
After constructing the directed graph structure, the GCN adopts a two-step convolution operation to fuse the local neighborhood nodes of each node and encodes the node feature vector g i , that is not related to the speaker, into feature vector representation h i , that is related to the speaker’s emotional interaction information. The calculation process is as follows:
h t ( 1 ) = σ ( r R s Y w t s c t , r W r ( 1 ) g s + w t t W 0 ( 1 ) g t ) , i = 1 , 2 , , Y
h t ( 2 ) = σ ( s Y W ( 2 ) h s ( 1 ) + W 0 ( 2 ) h t ( 1 ) ) , t = 1 , 2 , , Y
where σ is an activation function; w 0 ( 1 ) , w r ( 1 ) , w 0 ( 2 ) , and w ( 2 ) are transformation parameters. Formulas (10) and (11) can effectively aggregate the affective interaction information of local domain speakers at each statement node in the directed graph, and the self-connected edges can also ensure the transformation of autocorrelation features.

3.4. Sentiment Classifier

The sentiment classifier fuses multiple feature coding structures to output the affective tendency label X i . Specifically, we first carry out the serial aggregation of the conversation context semantic feature encoding G i , the emotional interaction feature encoding between speakers h i , and the single-utterance semantic feature encoding e i , as shown in Equation (12):
M i = [ G i , h i , e i ]
Then, the attention mechanism is used to obtain the final conversation text feature representation M i ˜ , as shown in Equations (13) and (14):
β i = S o f t m a x ( M i T W β   [ M 1 , M 2 , , M n ] )
M i ˜ = β i   [ M 1 , M 2 , , M n ] T
Finally, the fused encoding results are input to the fully connected layer network, the sentiment classification probability distribution is obtained through the SoftMax function, and the sentiment label X i with the highest probability is output:
l i = R e L U ( W l M i ˜ + b l )
P i = S o f t m a x ( W l i + b )
X i = a r g m a x ( P i   [ M ] )
where b and b l are the parameters of the fully connected layer; P i is the probability distribution of utterance i corresponding to each sentiment state ;   W l and W are the weight of the training process learning; and   X i represents the label corresponding to the maximum probability in the P i , which is the sentiment state corresponding to the ith sentence utterance identified by the model.

4. Experiments

4.1. Experimental Setup

4.1.1. Datasets

Our experiments are conducted on the JDDC dataset, which is obtained from JD Dialogue Challenge Competition (https://github.com/EndlessLethe/jddc2019-3rd-retrieve-model, (accessed on 25 December 2022)). To the best of my knowledge, the JDDC dataset is a large-scale customer service conversation dataset in the field of e-commerce, which is suitable for customer sentiment analysis in customer service conversation scenarios.
We first process the dataset by cleaning, deleting, and removing noise and irrelevant content. Each utterance is then annotated with one of five sentiment labels: very negative, negative, neutral, positive, and very positive. The specifications in the annotation process are as follows.
If there are two or more negative emotional messages, the emotional tendency of the utterance is marked as very negative, otherwise, the emotional tendency is marked as negative, as follows:
Customer: It’s been several times, you are too perfunctory. (very negative)
Customer: Why has not my order shipped yet? (negative)
If the utterance is of a simple consultation and does not have any emotional color, it is marked as neutral, as follows:
Customer: Hello, are you there? (neutral)
If there are two or more positive emotional messages, the emotional tendency of the utterance is marked as very positive, otherwise the emotional tendency is marked as positive, as follows:
Customer: The quality of the goods is good, I will give you good reviews. (very positive)
Agent: Hello, thank you for coming, how can I help you? (positive)
We arranged for three annotators to label each utterance sentiment. If two of them do not agree on their sentiment labeling, an expert makes the final decision. The data annotation results show that the consistency of the two is above 89%, and the consistency of the three is above 83%. The calculation of the Kappa coefficient between the two labeled persons shows that the mean value of the Kappa coefficient is greater than 0.75. Based on the results of the abovementioned indicators, the data annotation of this topic has a good consistency, and the quality of the data annotation meets the experimental standards.
After labeling the conversation sentiment of the dataset, the dataset is divided into the training set, verification set, and test set according to the ratio of 7:1:2, and the dataset is statistically analyzed. Table 2 shows the distribution of five types of sentiment labels on the dataset. Neutral occurs most frequently of all sentiments, which is in conformity to the characteristics of conversation in the field of e-commerce. In addition, the dataset contains 6305 conversations where the average turns of a conversation are 11.2.

4.1.2. Parameter Settings

The experiments are based on the deep learning framework PyTorch and use Baidu’s ERNIE-based model (12 encoder layers, 768 hidden states, 12 self-attention heads, 110 M) as the pre-training model. The vector dimension of each utterance embedded in the output layer is 768, and the number of GRU neural units in the context information extraction layer is 128, resulting in a total of two layers. The batch size of the training is eight, the optimization function of the model is Adam, the initial learning rate is e 3 , and the dropout rate is 0.3. Considering that the affective tendency classification in this experiment belongs to a multi-classification scenario and has an unbalanced distribution, we use the cross-entropy loss function as the training loss function.

4.1.3. Evaluation Criteria

Four evaluation criteria, namely precision (Pr), recall (Re), F1measure (F1), and accuracy (Acc), are used to assess the performance of the models. These criteria are extensively used in text classification and sentiment analysis tasks [23]. These criteria are calculated as follows:
A c c u r a c y = T P + T N T P + T N + F P + F N
P r e c i s o n = T P T P + F P
R e c a l l = T P T P + F P
F 1 = 2 Precison R e c a l l P r e c i s o n + R e c a l l
M a c r o F 1 = 1 N F 1 i
where T P , T N , F P , and F N are true positive, true negative, false positive, and false negative, respectively [24].

4.2. Baselines Methods

To evaluate the performance of our model, we implement the following baseline models to sentiment recognition in conversation:
(1)
BiGRU [25]: Regardless of the contextual information in the conversation, it treats each utterance as an independent instance and uses a bidirectional GRU to encode the utterance and classify sentiment.
(2)
BERT [26]: This model is used to construct the utterance representations which are sent to a two-layer perceptron with a final SoftMax layer for sentiment classification.
(3)
ERNIE [22]: This model treats each sentence in the dialogue as an independent instance and uses the ERNIE model to encode the sentence and classify sentiment.
(4)
c-LSTM [9]: This model uses a context-sensitive LSTM model for sentiment classification.
(5)
BiGRU-Att [27]: The model uses the BiGRU network to encode and represent the context information for sentiment classification.
(6)
CMN [13]: The model adopts two GRU models to extract contextual features from the conversation history of two speakers and passes the current utterance as input to two different memory networks to obtain the utterance representation of the two speakers for sentiment classification.
(7)
DialogueRNN [15]: The model uses a BiGRU to model the speaker states, global states, and sentiment states based on recurrent neural networks (RNNs).
(8)
DialogueGCN [17]: Based on the graph neural network, the model constructs the conversation as a graph structure, represents the nodes in the graph as utterances, and uses the speaker’s information to determine the type of edge, to establish the time dependence and speaker dependency in the multi-party dialogue, and then realize the sentiment classification.

4.3. Results and Analysis

We compare the performance of our model with baselines on the JDDC dataset. The experimental results are shown in Table 3.
Firstly, by comparing the BiGRU, BERT, and ERNIE methods to treat each utterance of the conversation as a single-sentence instance experiment, it is found that the pre-trained model has an advantage in the semantic encoding of text compared with the BiGRU model. The F1 values of the BiGRU model are 2.08 and 2.24 lower than the values of BERT and ERNIE, respectively. At the same time, the semantic coding effect of the ERNIE pre-training model is slightly better than the BERT pre-training model, which is consistent with the experimental results provided by Baidu. In addition, The ERNIE model without considering context has a lower F1 value than that of the c-LSTM, BiGRU-Att, and CMN models considering context, which indicates that the context element of dialogue plays a vital role in sentiment recognition in dialogue sentiment analysis.
Secondly, the experimental results of DiaogueRNN, DiaogueGCN, and our models are significantly better than those of c-LSTM, BiGRU-Att, and CMN models by comparing c-LSTM, BiGRU-Att, CMN, DiaogueRNN, DiaogueGCN, and our model. The reason is that compared with other models, DiaogueRNN, DiaogueGCN, and our model all learn the affective interaction relationship between speakers. Although all three models incorporate the affective interaction dependence between speakers, DiaogueGCN and our model use the graph convolutional neural network to fuse the utterance neighborhood information to obtain the text representation of the sentence, so the experimental results of DiaogueGCN and our model are better than the DiaogueRNN model. Finally, the macro-F1 value of our model is 1.16 higher than that of DiaogueGCN model. Compared with the DiaogueGCN model, our model uses ERNIE pre-trained model for the dialogue text embedding and adopts multiple GRU and attention mechanisms to extract the semantic features of context more comprehensively to obtain a better sentiment classification performance.

4.3.1. Effectiveness Analysis of Contextual Semantic Information and Affective Interaction Information

We conduct combined comparative experiments from the aspects of the contextual semantic encoder and speaker affective interaction encoder to study the influence of the different components of our model on the emotion recognition results, the specific hybrid model as shown in Table 4, and the experimental results of different models as shown in Table 5. In Table 5, Our model(a) is composed of a conversation text encoder; Our model(b) is composed of a conversation text encoder and an affective interaction encoder; and Our model(c) is composed of a conversation text encoder and a context semantic encoder. Our model is thus composed of a conversation text encoder, a context semantic encoder, and an affective interaction encoder.
According to the experimental results of Table 4 and Table 5, the F1 value of affective tendency classification has been gradually improved with the addition of a contextual semantic encoder and speaker affective interaction encoder. According to the comparative experiments of Our model(a), Our model(c), Our model(b), and Our model, it is found that the recognition effect is greatly improved, considering the context semantic features. By analyzing the recognition effect of different categories, we find that the recognition effect of considering contextual semantic features on negative and positive affective tendencies is better than that of several other categories, which shows that the model can infer implicit emotions based on context.
At the same time, by comparing the results of Our model(a), Our model(b), and Our model(c), and Our model groups, it can be found that Our model(b) increased the macro-F1 value by 3.48% compared with Our model(a), and Our model increased the macro-F1 value by 3.87% compared with Our model(c). It shows that considering the emotional interaction dependence between speakers can improve the effect of emotion recognition. In addition, by comparing the experimental results of Our model(a), Our model(c), and Our model(b), we find that the contextual semantic features or the affective interaction features between speakers can improve sentiment recognition. And the importance of the conversation contextual semantic information is slightly higher than that of the speaker’s affective interaction information. Through the analysis of a context semantic encoder and an affective interaction encoder, we found that contextual semantic information and affective interaction information can effectively improve the accuracy of customer sentiment recognition.

4.3.2. Affective Interaction-Directed Graph Window Size

To study the influence of the context window size of the directed graph of the affective interaction on the experimental results, we observed the change of macro-F1 value under Our model and Our model(b) by changing the number of directional graph context window sizes. The experimental results are shown in Figure 4.
The experimental results show that when the window size is 0, the macro-F1 value results of Our model and Our model(b) are close to the results of the models without the affective interaction encoder, which indicates that the model performance without using the affective interaction information between speakers is poor. When the window size is 0 to 3, the macro-F1 value of the model starts to rise, indicating that the model begins to use the affective interaction information between speakers. As the window size continues to increase, the macro-F1 value begins to shift from stable to downward, which indicates that there is too much affective interaction between speakers and a certain amount of noise. Therefore, we set the window size of the emotional interaction-directed graph as 4.

4.3.3. The Impact Analysis of Feature Fusion Mode

After extracting the corresponding features through the context semantic encoder and the affective interaction encoder, it is necessary to fuse the two features and input them into the full connection layer to achieve sentiment classification. In order to study the impact of different fusion methods on the experimental results of sentiment classification, this paper observes the change of F1 value under different sentiment categories by setting three fusion methods, i.e., sum, maximum pooling, and series connection. The experimental results are shown in Figure 5.
The experimental results show that the series fusion method has the best F1 value in all sentiment categories because the series fusion method can retain more information than the other two fusion methods. In addition, the gap between the three fusion methods of maximum pooling, summing, and tandem was the smallest in the neutral sentiment category. The effect of the series fusion mode was significantly better than that of the other two fusion methods in the negative and positive sentiment categories. It indicates that the series method can better retain sentiment characteristics.

5. Conclusions

In this paper, we proposed an efficient model to recognize customer sentiment in customer service conversations. The model consists of a conversation text encoder, context semantic encoder, affective interaction encoder, and sentiment classifier. Firstly, the conversation text encoder uses ERNIE pre-trained model to generate the utterance representations. Then, the context semantic encoder uses multiple GRU neural networks and attention mechanisms to encode different contexts to obtain more comprehensive context semantic features. Meanwhile, the affective interaction encoder constructs a directed graph to depict the affective interaction relationship between speakers and uses GCN to encode its affective interaction features. Finally, after fusing the encoding of different features, the sentiment classifier outputs the predicted sentiment label. To verify the performance of our model, we select eight baseline models for the same task. Experimental results on the JDDC dataset show that the performance of our model is better than other baseline models in terms of recognizing customer sentiment.
Although our model captures different speakers’ contextual information and inter-speaker affective interaction information that can improve the accuracy of sentiment recognition, our study has certain limitations. The proposed model does not take conversation topics or multimodal data into account. Therefore, the following two research directions merit future exploration: (1) consider more factors that affect the accuracy of sentiment recognition in conversations, such as conversational topics, and (2) incorporate multimodal information into our work.

Author Contributions

Conceptualization, Z.H., H.L. and J.Z.; methodology, H.L. and J.Z.; software, J.M.; validation, Z.H., H.L. and J.Z.; formal analysis, H.L. and J.Z.; investigation, H.L. and J.Z.; resources, J.Z.; data curation, H.L. and J.M.; writing—original draft preparation, H.L.; writing—review and editing, Z.H., H.L., J.M. and J.Z.; visualization, J.Z.; supervision, Z.H.; project administration, J.M. All authors have read and agreed to the published version of the manuscript.

Funding

This research was funded by Cross-border E-commerce Teacher Competence Improvement Project of Guangxi Minzu Normal University “Research on User Behavior of Cross-border E-commerce Platform under the Background of Artificial Intelligence” (KJDSKYZD202203); Guangxi University Young and Middle-aged Teachers Basic Ability Improvement Project “Probability Numbers and its Application in Uncertain Decision Theory” (2022KY0764).

Institutional Review Board Statement

Not applicable.

Informed Consent Statement

Not applicable.

Data Availability Statement

The datasets used and/or analyzed during the current study are available from the corresponding author on reasonable request.

Acknowledgments

The author is thankful to China Three Gorges University for providing resources for this research.

Conflicts of Interest

The authors declare no conflict of interest.

References

  1. Chung, H.; Iorga, M.; Voas, J.; Lee, S. Alexa, Can I Trust You? Computer 2017, 50, 100–104. [Google Scholar] [CrossRef] [PubMed] [Green Version]
  2. Zhu, X. Case II (Part A): JIMI’s Growth Path: Artificial Intelligence Has Redefined the Customer Service of JD.Com. In Emerging Champions in the Digital Economy; Springer: Singapore, 2019. [Google Scholar] [CrossRef]
  3. Li, F.L.; Qiu, M.; Chen, H.; Wang, X.; Gao, X.; Huang, J.; Ren, J.; Zhao, Z.; Zhao, W.; Wang, L.; et al. AliMe Assist: An Intelligent Assistant for Creating an Innovative E-commerce Experience. In Proceedings of the 2017 ACM on Conference on Information and Knowledge Management, Singapore, 6–10 November 2017; pp. 2495–2498. [Google Scholar] [CrossRef]
  4. Sun, X.; Zhang, C.; Li, L. Dynamic emotion modelling and anomaly detection in conversation based on emotional transition tensor. Inf. Fusion 2019, 46, 11–22. [Google Scholar] [CrossRef]
  5. Majid, R.; Santoso, H.A. Conversations Sentiment and Intent Categorization Using Context RNN for Emotion Recognition. In Proceedings of the 2021 7th International Conference on Advanced Computing and Communication Systems (ICACCS), Coimbatore, India, 19–20 March 2021; pp. 46–50. [Google Scholar] [CrossRef]
  6. Wei, J.; Feng, S.; Wang, D.; Zhang, Y.; Li, X. Attentional Neural Network for Emotion Detection in Conversations with Speaker Influence Awareness. In Natural Language Processing and Chinese Computing: 8th CCF International Conference, NLPCC 2019, Dunhuang, China, 9–14 October 2019; Springer International Publishing: Berlin/Heidelberg, Germany, 2019. [Google Scholar]
  7. Huang, X.; Ren, M.; Han, Q.; Shi, X.; Nie, J.; Nie, W.; Liu, A.-A. Emotion Detection for Conversations Based on Reinforcement Learning Framework. IEEE Multimed. 2021, 28, 76–85. [Google Scholar] [CrossRef]
  8. Hu, D.; Wei, L.; Huai, X. DialogueCRN: Contextual Reasoning Networks for Emotion Recognition in Conversations. arXiv 2021, arXiv:2106.01978. [Google Scholar]
  9. Poria, S.; Cambria, E.; Hazarika, D.; Majumder, N.; Zadeh, A.; Morency, L.-P. Context-Dependent Sentiment Analysis in User-Generated Videos. In Proceedings of the 55th Annual Meeting of the Association-for-Computational-Linguistics (ACL), Vancouver, BC, Canada, 30 July–4 August 2017; pp. 873–883. [Google Scholar] [CrossRef] [Green Version]
  10. Zhong, P.; Wang, D.; Miao, C. Knowledge-Enriched Transformer for Emotion Detection in Textual Conversations. In Proceedings of the Conference on Empirical Methods in Natural Language Processing/9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP), Hong Kong, China, 3–7 November 2019; pp. 165–176. [Google Scholar]
  11. Tang, D.; Qin, B.; Feng, X.; Liu, T. Effective LSTMs for Target-Dependent Sentiment Classification. In Proceedings of the COLING 2016, the 26th International Conference on Computational Linguistics: Technical Papers, Osaka, Japan, 11–16 December 2016; pp. 3298–3307. [Google Scholar]
  12. Basiri, M.E.; Nemati, S.; Abdar, M.; Cambria, E.; Acharrya, U.R. ABCDM: An Attention-based Bidirectional CNN-RNN Deep Model for sentiment analysis. Future Gener. Comput. Syst. Int. J. Escience 2021, 115, 279–294. [Google Scholar] [CrossRef]
  13. Hazarika, D.; Poria, S.; Zadeh, A.; Cambria, E.; Morency, L.P.; Zimmermann, R. Conversational Memory Network for Emotion Recognition in Dyadic Dialogue Videos. Proc. Conf. 2018, 2018, 2122–2132. [Google Scholar] [CrossRef] [PubMed]
  14. Hazarika, D.; Poria, S.; Mihalcea, R.; Cambria, E.; Zimmermann, R. ICON: Interactive Conversational Memory Network for Multimodal Emotion Detection. In Proceedings of the Conference on Empirical Methods in Natural Language Processing (EMNLP), Brussels, Belgium, 31 October–4 November 2018; pp. 2594–2604. [Google Scholar]
  15. Majumder, N.; Poria, S.; Hazarika, D.; Mihalcea, R.; Gelbukh, A.; Cambria, E. DialogueRNN: An Attentive RNN for Emotion Detection in Conversations. In Proceedings of the 33rd AAAI Conference on Artificial Intelligence/31st Innovative Applications of Artificial Intelligence Conference/9th AAAI Symposium on Educational Advances in Artificial Intelligence, Honolulu, HI, USA, 17 July 2019; pp. 6818–6825. [Google Scholar]
  16. Zhang, D.; Wu, L.; Sun, C.; Li, S.; Zhu, Q.; Zhou, G. Modeling both Context- and Speaker-Sensitive Dependence for Emotion Detection in Multi-speaker Conversations. In Proceedings of the 28th International Joint Conference on Artificial Intelligence, Macao, China, 10–16 August 2019; pp. 5415–5421. [Google Scholar]
  17. Ghosal, D.; Majumder, N.; Poria, S.; Chhaya, N.; Gelbukh, A. DialogueGCN: A Graph Convolutional Neural Network for Emotion Recognition in Conversation. In Proceedings of the Conference on Empirical Methods in Natural Language Processing/9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP), Hong Kong, China, 30 August 2019; pp. 154–164. [Google Scholar]
  18. Wang, Y.; Zhang, J.; Ma, J.; Wang, S.; Xiao, J. Contextualized Emotion Recognition in Conversation as Sequence Tagging. In Proceedings of the 21st Annual Meeting of the Special-Interest-Group-on-Discourse-and-Dialogue (SIGDIAL), Electr Network, 1st Virtual Meeting, Virtual, 1–3 July 2020; pp. 186–195. [Google Scholar]
  19. Gao, Q.; Cao, B.; Guan, X.; Gu, T.; Bao, X.; Wu, J.; Liu, B.; Cao, J. Emotion recognition in conversations with emotion shift detection based on multi-task learning. Knowl.-Based Syst. 2022, 248, 108861. [Google Scholar] [CrossRef]
  20. Zhu, L.; Pergola, G.; Gui, L.; Zhou, D.; He, Y. Topic-Driven and Knowledge-Aware Transformer for Dialogue Emotion Detection. In Proceedings of the Joint Conference of 59th Annual Meeting of the Association-for-Computational-Linguistics (ACL)/11th International Joint Conference on Natural Language Processing (IJCNLP)/6th Workshop on Representation Learning for NLP (RepL4NLP), Electr Network, Online, 2 June 2021; pp. 1571–1582. [Google Scholar]
  21. Liu, R.; Ye, X.; Yue, Z. Review of pre-trained models for natural language processing tasks. J. Comput. Appl. 2021, 41, 1236–1246. [Google Scholar] [CrossRef]
  22. Sun, Y.; Wang, S.; Feng, S.; Ding, S.; Pang, C.; Shang, J.; Liu, J.; Chen, X.; Zhao, Y.; Lu, Y.; et al. Ernie 3.0: Large-scale knowledge enhanced pre-training for language understanding and generation. arXiv 2021, arXiv:2107.02137. [Google Scholar]
  23. Khiabani, P.J.; Basiri, M.E.; Rastegari, H. An improved evidence-based aggregation method for sentiment analysis. J. Inf. Sci. 2020, 46, 340–360. [Google Scholar] [CrossRef]
  24. Liu, B. Sentiment Analysis: Mining Opinions, Sentiments, and Emotions; Cambridge University Press: Singapore, 2020. [Google Scholar]
  25. Shen, J.; Liao, X.; Tao, Z. Sentence-Level Sentiment Analysis via BERT and BiGRU. In Proceedings of the 2nd International Conference on Image and Video Processing, and Artificial Intelligence (IPVAI), Shanghai, China, 23–25 August 2019; p. 11321. [Google Scholar] [CrossRef]
  26. Yenduri, G.; Rajakumar, B.R.; Praghash, K.; Binu, D. Heuristic-Assisted BERT for Twitter Sentiment Analysis. Int. J. Comput. Intell. Appl. 2021, 20, 2150016. [Google Scholar] [CrossRef]
  27. Zhou, L.; Bian, X. Improved text sentiment classification method based on BiGRU-Attention. J. Phys. Conf. Ser. 2019, 1345, 032097. [Google Scholar] [CrossRef]
Figure 1. Example of customer service conversation.
Figure 1. Example of customer service conversation.
Applsci 13 07807 g001
Figure 2. The illustration of our proposed framework, which consists of a conversation text encoder, a context semantic encoder, an affective interaction encoder, and sentiment classifier.
Figure 2. The illustration of our proposed framework, which consists of a conversation text encoder, a context semantic encoder, an affective interaction encoder, and sentiment classifier.
Applsci 13 07807 g002
Figure 3. Attention mechanism weighting contextual semantics.
Figure 3. Attention mechanism weighting contextual semantics.
Applsci 13 07807 g003
Figure 4. The effect of window size on the macro-F1 value.
Figure 4. The effect of window size on the macro-F1 value.
Applsci 13 07807 g004
Figure 5. The impact of different fusion methods on F1 value.
Figure 5. The impact of different fusion methods on F1 value.
Applsci 13 07807 g005
Table 1. The type of relationship between speakers.
Table 1. The type of relationship between speakers.
NumberRelationship between Speakers
1 P 1 P 1
2 P 1 P 1
3 P 2 P 2
4 P 2 P 2
5 P 1 P 2
6 P 1 P 2
7 P 2 P 1
8 P 2 P 1
where p i p j represents two utterances in sequential order; u i and u j are derived from customers and agent, respectively; and u i precedes the u j utterance. p i p j indicates u i after the u j utterance.
Table 2. Information of the dataset.
Table 2. Information of the dataset.
SentimentTrainDev.TestProportion
Very negative10381632821483 (2.1%)
Negative346661310195098 (7.22%)
Neutral31,6253953834543,923 (62.2%)
Positive12,7942482381919,095 (27.04%)
Very positive7221021931017 (1.44%)
Total utterances49,645731313,65870,616
Table 3. The performances of different models.
Table 3. The performances of different models.
ModelF1 ValueMacro-F1
Very NegativeNegativeNeutralPositiveVery Positive
BiGRU50.555.178.172.363.363.86
BERT52.156.682.274.264.665.94
ERNIE52.356.682.574.364.866.1
c-LSTM55.259.782.276.167.268.08
BiGRU-Att55.760.182.776.567.868.56
CMN56.960.982.876.769.169.28
DiaogueRNN58.561.983.377.570.470.32
DiaogueGCN59.262.583.377.671.170.74
Our model60.364.683.278.972.571.90
Table 4. Hybrid models of different component structures.
Table 4. Hybrid models of different component structures.
ModelConversation Text EncoderContext Semantic EncoderAffective Interaction Encoder
Our model(a)××
Our model(b)×
Our model(c)×
Our model
Table 5. The experimental results of different hybrid models.
Table 5. The experimental results of different hybrid models.
ModelF1 ValueMacro-F1
Very NegativeNegativeNeutralPositiveVery Positive
Our model(a)52.356.682.574.364.866.1
Our model(b)56.560.181.275.868.468.4
Our model(c)56.861.481.976.669.769.28
Our model60.364.683.578.972.571.96
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Share and Cite

MDPI and ACS Style

Huang, Z.; Liu, H.; Zhu, J.; Min, J. Customer Sentiment Recognition in Conversation Based on Contextual Semantic and Affective Interaction Information. Appl. Sci. 2023, 13, 7807. https://doi.org/10.3390/app13137807

AMA Style

Huang Z, Liu H, Zhu J, Min J. Customer Sentiment Recognition in Conversation Based on Contextual Semantic and Affective Interaction Information. Applied Sciences. 2023; 13(13):7807. https://doi.org/10.3390/app13137807

Chicago/Turabian Style

Huang, Zhengwei, Huayuan Liu, Jun Zhu, and Jintao Min. 2023. "Customer Sentiment Recognition in Conversation Based on Contextual Semantic and Affective Interaction Information" Applied Sciences 13, no. 13: 7807. https://doi.org/10.3390/app13137807

APA Style

Huang, Z., Liu, H., Zhu, J., & Min, J. (2023). Customer Sentiment Recognition in Conversation Based on Contextual Semantic and Affective Interaction Information. Applied Sciences, 13(13), 7807. https://doi.org/10.3390/app13137807

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop