# Emotion Analysis of Literary Works Based on Attentional Mechanisms and the Fusion of Two-Channel Features

Authors: Yanli Han
Journal: Scientific Programming
 (2022)

---

## Abstract

In order to analyze sentiment data of foreign literary works, this paper proposes an algorithm for sentiment classification of literary works. We do this by fusing different features of literary works, which in turn captures more feature information for the classifier. As traditional word embedding models are difficult to achieve fusion with the sentiment features of literary works, we consider a multifeature fusion approach of word embedding features and lexical features of literary works. A two-channel and single-channel comparison is also used to analyze the classification accuracy based on the two feature fusion methods, and a parallel CNN and BiLSTM-attention two-channel neural network model proposed. Finally, the proposed model was evaluated using a real dataset of sentiment reviews of literary works and compared with different classification algorithms in the experiments. The experimental results show that the new hybrid approach has better classification accuracy, recall, and F1 metrics. The proposed methodology is an important guide for the creation of literary works and their screenplays, as it can be used to judge whether a work appeals to readers and, importantly, can also be considered as one of the criteria for the success of a film adaptation of a literary work.


---

## Body

## 1. Introduction

Since the beginning of the new era, people’s attention to contemporary literature has gradually increased, both in terms of genre and content, which is very different from traditional literature, especially in the three areas of values, ideology, and emotional values. Modern and contemporary foreign literature has a more humanistic approach to emotional values than traditional literature, as well as reflects the individual emotions of the author. In the development of foreign literature, the embodiment of emotional value in modern and contemporary foreign literature is more focused on the experience, and through reading it, one can understand the humanistic and personal feelings embedded in the work and thus grasp the author’s personality and spiritual experience. In contrast to traditional foreign works, contemporary foreign literature is more open in its expression and more emotive.A popular foreign work of literature contains a wealth of emotion. The extraction of emotion from a literary work has become a reality, and it is vital to systematically analyze the time series of emotion extracted [1]. Emotion is the soul of a literary work, and existing studies have largely addressed the importance of emotion to a literary work from a qualitative perspective and how the emotion of a literary work changes. This paper will use complexity science methods to quantitatively analyze emotion in foreign literature and its applications.Online reviews of e-commerce, such as consumer-initiated comments on the quality of goods and services, etc., play a role in the purchasing decisions of potential consumers and directly influence the user stickiness of e-commerce platforms. The process of mining these reviews for positive and negative attitudes in order to identify people’s propensity to buy a product is known as sentiment analysis [2] (SA). The goal of sentiment analysis is to extract all the points of view from a document that contains information about the points of view, an analysis method that uses natural language processing and text mining techniques, a method that takes a large amount of data and analyses it to get an understanding of something. In the early days, sentiment analysis was solved by constructing classifiers methods. Leeuw et al. [3] first proposed to solve the problem of sentiment classification using machine learning algorithms including parsimonious Bayes (NB), they used n-grams models and lexical properties to extract features of film reviews [4]. The main contribution of the fine-grained sentiment analysis method is to extract the corresponding features by syntactic analysis and to compare the experiments with the TF-IDF benchmark model, and their proposed model improves the accuracy (precision), recall (recall), and F1-score in positive or negative evaluations. Wei et al. [4, 5] extracted the features of Chinese hotel reviews by word embedding and put them into classifiers plain Bayesian (NB), support vector machine (SVM), and CNN for comparison, where SVM performed the best in classification. The word embedding approach can extract key information and hierarchical information of words from the comment text, but it cannot extract the information of emotions expressed in the words, so fusing the two features can express the information in the comment more comprehensively.Now many scholars are very enthusiastic about applying deep learning models to sentiment analysis, applying ever-improving classical deep learning models to this domain, and even proposing new deep learning models in order to solve problems in this domain. TextCNN models were proposed earlier by Mosleh [6], using CNN algorithm to deal with the problem of sentence classification, and obtained better results than previous studies in four out of seven tasks. Liu et al. [7] used Glove to extract features and put them into a very deep CNN model for Twitter sentiment classification experiments, and the results showed that their model had higher accuracy and F1 values than the baseline model. In addition to CNNs, the long short term memory (LSTM) algorithm in deep learning, which is believed to be better at learning contextual information from text, has also been applied to the problem of sentiment classification, and Mansaray et al. [8] used LSTMs to replace the pooling layer in CNNs to perform binary and quintuple classification experiments with higher accuracy than the previously proposed models. In addition, many scholars have combined multiple features in text [9] to achieve better classification results. Nguyen et al. [10] fused word embedding features, sentiment information features, and linguistic knowledge features and overcame the disadvantages of word embedding based on relevant strategies, and their model has advantages over other classical methods. The feature fusion method used in this paper is implemented using the Syuzhet R language package. This is done by extracting the sentiment time series of a literary work to obtain the sentiment score of each sentence in the literary work and then using channel fusion and attention mechanisms to quantitatively analyze the sentiment of a variety of foreign literary works.


## 2. Model Principles

Since the word embedding model cannot contain the sentiment information of words well, this paper proposes the PWCNN model and PW2CNN model to apply the combination of lexical features to make the information contained in the features richer. While a single CNN model cannot capture the temporal information of a sentence well, adds an attention mechanism, and proposes a parallel classification algorithm PW2CNN and BiLSTMatt model.


### 2.1. Word2vec + CNN Model

The classical model of TextCNN was [11] proposed by Phan, where each word is a one dimensional vector and a sentence forms a matrix. Convolutional operations are performed by different convolutional kernels, then dimensionality reduction is performed by pooling operations, and finally, binary classification is performed using a sigmoid function.Earlier, the bag of words (BOW) model represented a vector of word frequencies for each sentence by making a bag of all the words in the document and constructing a corresponding dictionary so that the resulting vector corresponds to the dictionary and represents the frequency of the words. In longer sentence sets, this approach results in a very sparse matrix and the loss of information about the order of words. The word embedding model word2vec takes better account of word position relations [12–14] and solves the problem of oversparsity when vectorizing words with one-hot encoding.The word embedding model is proposed to better learn word representations quickly and accurately on a large dataset, using the idea of embedding high-dimensional word vectors into a low-dimensional space so that words with adjacent meanings have closer spatial distances. By improving on the BOW model, the continuous bag-of-words model (CBOW) produces a matrix with a dimension of 256 × 128, which is initially set in the article, with each matrix text represented by 128 dimensions so that the concatenation of words can form a feature vector matrix, which is filled with zeros in the case of a sentence with no more than 256 words.The word2vec + CNN model is a modification of the classical TextCNN model, where the CNN structure is convolved on the feature matrix of each sentence by a number of different 4 × 4 convolution kernels. The input text matrixX∈RN×Nand filter W∈RN×V, and the two-dimensional convolution is given as follows:(1)cij=∑Uu=0∑Vv=0wuvxi−u+1,j−v+1.Equation (1) represents the process of multiplying the elements of the text matrix Xxijand the elements wuv of the convolution kernel matrix W to obtain the features cij using a filter W with a window size of U×Vxi,j to, xi−u+1,j−v+1, which results in multiple feature matrices.The first layer in Figure1 is the input layer, the last layer is the output layer, and the layers in between represent the structure [15] of the CNN. This model has two convolutional layers and one pooling layer. The first has 32 convolutional kernels, all of which are 4 × 4 matrices, and the activation function is a ReLu function. The second convolutional layer has 16 convolutional kernels, all of which are 4 × 4 in size, and also uses the ReLu function. The reason for using the ReLu function is that it is less computationally intensive than the other activation functions and provides better protection against overfitting. The third layer is the maximum pooling layer, with a pooling kernel size of 2 × 2.Figure 1
CNN model in 1word2vec + CNN model.


### 2.2. PWCNN Model

In this experiment, the word2vec + CNN benchmark model is a single-channel CNN model with word2vec as input, and has the same structure as the CNN model in the two-channel PWCNN model, except for the input of the features [16, 17]. The two features are the word embedding word2vec model matrix (256 × 128 × 1 dimension) and the part-of-speech (POS) feature input matrix (220 × 56 × 1 dimension).The lexical annotation determines the lexical annotation of each word in the sentence and uses lexical features to disambiguate on the basis of participles. These lexical words are better able to express the subjective feelings of the reviewer, so the model focuses more on adverbs, verbs, and adjectives. The more important lexical features that the model focuses on are adjectives, adverbs, and verbs, as these lexical features are better at conveying the subjective feelings of the commenter. In addition, punctuation is also important in a sentence and thus is not considered for removal of punctuation when performing subordination and giving the lexicality of the corresponding subword. The PWCNN model splices the word vectors trained by the word embedding word2vec model with the lexical vectors, including two splicing methods, as shown in Figure2 and Equation (2) [18].(2)X=XW,XP,where XW denotes the word embedding word2vec model matrix; XP denotes the lexical annotation feature input matrix.Figure 2
Word vector and lexical vector splicing diagram for word embedding model training.In addition, the POS features and word2vec features of each sentence are stitched together one by one so that the whole feature matrix is meaningful. The spliced feature vectors are then trained in the same single-channel CNN model as the word2vec + CNN model, mainly to directly compare [19] the experimental results of the feature fusion single-channel model with the benchmark model. Given the difference in structure between the CNN model and the classical TextCNN model, this “top-down” rather than “left-right” splicing was chosen, but the “left-right” splicing is also worth trying. The stitching is also worth trying. At the same time, it was found that the two splicing methods have little effect on the experimental results and made no difference to the CNN. The word vector of fused features was put into the same structure of convolution as mentioned above for the experiments, and the activation function and parameters were set in the same way. The information in the feature vector is extracted through a two-layer convolutional layer, then further reduced and aggregated through a pooling layer, where full connectivity is performed through a random dropout, and to further prevent overfitting (reducing parameters), a dropout is added after this flatten layer, and finally, classification is performed. The experimental model is shown in Figure 3.Figure 3
PWCNN model.This experiment is compared with the word2vec + CNN model to clearly determine whether POS features can play a role in this classification experiment. The experiments prove that the input matrix with POS features does have better classification results. The next step is to further consider a two-channel CNN model based on this single-channel model and explore whether the same features are affected when they enter the same structural CNN model separately.


### 2.3. PW2CNN Model

It is well known that the two-channel model differs from the single-channel model in terms of the input method. In the single-channel model, the input is spliced with multiple features to obtain the fused features, while in the two-channel model, it is obtained by inputting different features separately [20, 21], and feature fusion can be achieved by matrix splicing. The two-channel CNN model has a matrix of POS features on one side and a matrix of word2vec features on the other side. The two feature matrices are processed separately by the CNN (two convolutional layers, a pooling layer), and the two processed features are “flattened” in the transition layer (the process of turning multidimensional data into one dimensional) and “left-right.” The purpose of this is also to preserve the information on both sides.(3)C=C1,C2,where C1 denotes the convolutional feature matrix with POS features as input; C2 denotes the matrix convolutional feature matrix with word2vec model as input.The overall structure of the model is shown in Figure4.Figure 4
PW2CNN model.In order to ensure comparability between the models, the structure of the CNNs for the dual and single channels was basically kept the same [22], and the comparison of the experimental results revealed that the improvement in the correctness and F1 values on their validation sets was not significant. However, when the CNN on the dual channel side of the model was replaced with a BiLSTM, the results changed significantly, indicating that it is not only the selection of features (the selection of information) but also the selection of the classifier that affects the overall results. When one side of the input is a POS feature, the CNN is able to extract the local features very well. When the other side of the input is a word2vec model, a BiLSTM model that takes into account the context is used, as the word embedding features themselves have information about the word itself. In summary, such a classifier has better experimental results and is the reason why this model is proposed in this paper.


### 2.4. PW2CNN and BiLSTMatt Models

The proposed PW2CNN and BiLSTMatt model uses the word2vec model [23] for word embedding, CNN, and BiLSTM models for classifier, and incorporates an attention mechanism. As the RNN (recurrent neural network) will lose its ability to learn long-term information, i.e., there is a long-term dependency problem, as the gradient will disappear or explode after multiple propagations with increasing input time series. For this reason, LSTM [24], is introduced into the model design. LSTM removes or adds information to the cell states through a gate structure.A bidirectional long and short-term memory network (BiLSTM) usually consists of two LSTMs connected, including a positive and a negative one. The positive LSTM captures the past information in the sentence and the negative LSTM acquires the future information in the sentence. In this way, the model is able to extract contextual information, and therefore, the prediction results of the bidirectional LSTM will be more accurate. For the problem of sentiment classification of text, the model is very suitable, as it contains all the forward and backward information in the sentence.(4)it=σWiht−1,xt+bict=ft⊙ct−1+it⊙c˜tft=σWfht−1,xt+bfot=σWoht−1,xt+boc˜t=tanhWcht−1,xt+bcht=ot⊙tanhCt.The LSTM network introduces a new internal stateinternalstatect∈RD for information transfer and outputs information to the state ht∈RD of the hidden layer bi, where ft∈0,1D, it∈0,1D, and Ot∈0,1D are three gates to control the path of information transfer and ⊙ is the product of vector elements. ct−1 is the product of vector elements. c˜t∈RD is the memory unit of the previous moment.The attention mechanism (AM) [25, 26] is inspired by the human cognitive function of extracting and receiving small portions of important information from a large amount of information and ignoring the rest. Similarly, the essence of the AM is to focus on certain key parts of the input and give them a higher weight. The hidden state of an LSTM model based on the AM at any given moment depends not only on the state of the hidden layer at the current moment and the output at the previous moment but also on the contextual features, which are obtained by a weighted average. This is calculated as follows:(a)
Calculate the attention distribution.(5)ai=pz=i∣X,q=softmaxsxi,q=expsxi,q∑Nj=1expsxi,q.(b)
A weighted average of the input information is calculated based on the attention distribution.(6)attX,q=∑Ni=1αixi=Ez∼pz∣X,qx.To calculate the attention distribution is to calculate the probability of selecting the first input vector given the query vectoraiq and the input X. Where: z∈1,N is the attention variable. The first z=ii input vector is selected; ai is the AM; sxi,qis the attention scoring function.The CNN and BiLSTM were chosen as parallel structures for the model classifier. The CNN model was able to extract a certain class of lexical features (e.g. adjectives, adverbs, nouns) that are more significant for the expression of emotions. The BiLSTM is more suitable for capturing temporal information features [27].The current state in the bidirectional LSTM should also be related to the contextual features, and the output is influenced by the weighted average of the hidden states of all moments fed into the current state through the attention mechanism. The weights in the attention mechanism are adjusted according to the difference between the output and the real situation. In fact, it can be demonstrated through this experiment that this parallel model gives the best classification results compared to the benchmark model, which not only makes full use of the different feature information but also takes advantage of the different neural network models [28, 29]. This model gives better classification results than the two-channel CNN model, suggesting that the BiLSTM model with the attention mechanism plays an important role.


## 2.1. Word2vec + CNN Model

The classical model of TextCNN was [11] proposed by Phan, where each word is a one dimensional vector and a sentence forms a matrix. Convolutional operations are performed by different convolutional kernels, then dimensionality reduction is performed by pooling operations, and finally, binary classification is performed using a sigmoid function.Earlier, the bag of words (BOW) model represented a vector of word frequencies for each sentence by making a bag of all the words in the document and constructing a corresponding dictionary so that the resulting vector corresponds to the dictionary and represents the frequency of the words. In longer sentence sets, this approach results in a very sparse matrix and the loss of information about the order of words. The word embedding model word2vec takes better account of word position relations [12–14] and solves the problem of oversparsity when vectorizing words with one-hot encoding.The word embedding model is proposed to better learn word representations quickly and accurately on a large dataset, using the idea of embedding high-dimensional word vectors into a low-dimensional space so that words with adjacent meanings have closer spatial distances. By improving on the BOW model, the continuous bag-of-words model (CBOW) produces a matrix with a dimension of 256 × 128, which is initially set in the article, with each matrix text represented by 128 dimensions so that the concatenation of words can form a feature vector matrix, which is filled with zeros in the case of a sentence with no more than 256 words.The word2vec + CNN model is a modification of the classical TextCNN model, where the CNN structure is convolved on the feature matrix of each sentence by a number of different 4 × 4 convolution kernels. The input text matrixX∈RN×Nand filter W∈RN×V, and the two-dimensional convolution is given as follows:(1)cij=∑Uu=0∑Vv=0wuvxi−u+1,j−v+1.Equation (1) represents the process of multiplying the elements of the text matrix Xxijand the elements wuv of the convolution kernel matrix W to obtain the features cij using a filter W with a window size of U×Vxi,j to, xi−u+1,j−v+1, which results in multiple feature matrices.The first layer in Figure1 is the input layer, the last layer is the output layer, and the layers in between represent the structure [15] of the CNN. This model has two convolutional layers and one pooling layer. The first has 32 convolutional kernels, all of which are 4 × 4 matrices, and the activation function is a ReLu function. The second convolutional layer has 16 convolutional kernels, all of which are 4 × 4 in size, and also uses the ReLu function. The reason for using the ReLu function is that it is less computationally intensive than the other activation functions and provides better protection against overfitting. The third layer is the maximum pooling layer, with a pooling kernel size of 2 × 2.Figure 1
CNN model in 1word2vec + CNN model.


## 2.2. PWCNN Model

In this experiment, the word2vec + CNN benchmark model is a single-channel CNN model with word2vec as input, and has the same structure as the CNN model in the two-channel PWCNN model, except for the input of the features [16, 17]. The two features are the word embedding word2vec model matrix (256 × 128 × 1 dimension) and the part-of-speech (POS) feature input matrix (220 × 56 × 1 dimension).The lexical annotation determines the lexical annotation of each word in the sentence and uses lexical features to disambiguate on the basis of participles. These lexical words are better able to express the subjective feelings of the reviewer, so the model focuses more on adverbs, verbs, and adjectives. The more important lexical features that the model focuses on are adjectives, adverbs, and verbs, as these lexical features are better at conveying the subjective feelings of the commenter. In addition, punctuation is also important in a sentence and thus is not considered for removal of punctuation when performing subordination and giving the lexicality of the corresponding subword. The PWCNN model splices the word vectors trained by the word embedding word2vec model with the lexical vectors, including two splicing methods, as shown in Figure2 and Equation (2) [18].(2)X=XW,XP,where XW denotes the word embedding word2vec model matrix; XP denotes the lexical annotation feature input matrix.Figure 2
Word vector and lexical vector splicing diagram for word embedding model training.In addition, the POS features and word2vec features of each sentence are stitched together one by one so that the whole feature matrix is meaningful. The spliced feature vectors are then trained in the same single-channel CNN model as the word2vec + CNN model, mainly to directly compare [19] the experimental results of the feature fusion single-channel model with the benchmark model. Given the difference in structure between the CNN model and the classical TextCNN model, this “top-down” rather than “left-right” splicing was chosen, but the “left-right” splicing is also worth trying. The stitching is also worth trying. At the same time, it was found that the two splicing methods have little effect on the experimental results and made no difference to the CNN. The word vector of fused features was put into the same structure of convolution as mentioned above for the experiments, and the activation function and parameters were set in the same way. The information in the feature vector is extracted through a two-layer convolutional layer, then further reduced and aggregated through a pooling layer, where full connectivity is performed through a random dropout, and to further prevent overfitting (reducing parameters), a dropout is added after this flatten layer, and finally, classification is performed. The experimental model is shown in Figure 3.Figure 3
PWCNN model.This experiment is compared with the word2vec + CNN model to clearly determine whether POS features can play a role in this classification experiment. The experiments prove that the input matrix with POS features does have better classification results. The next step is to further consider a two-channel CNN model based on this single-channel model and explore whether the same features are affected when they enter the same structural CNN model separately.


## 2.3. PW2CNN Model

It is well known that the two-channel model differs from the single-channel model in terms of the input method. In the single-channel model, the input is spliced with multiple features to obtain the fused features, while in the two-channel model, it is obtained by inputting different features separately [20, 21], and feature fusion can be achieved by matrix splicing. The two-channel CNN model has a matrix of POS features on one side and a matrix of word2vec features on the other side. The two feature matrices are processed separately by the CNN (two convolutional layers, a pooling layer), and the two processed features are “flattened” in the transition layer (the process of turning multidimensional data into one dimensional) and “left-right.” The purpose of this is also to preserve the information on both sides.(3)C=C1,C2,where C1 denotes the convolutional feature matrix with POS features as input; C2 denotes the matrix convolutional feature matrix with word2vec model as input.The overall structure of the model is shown in Figure4.Figure 4
PW2CNN model.In order to ensure comparability between the models, the structure of the CNNs for the dual and single channels was basically kept the same [22], and the comparison of the experimental results revealed that the improvement in the correctness and F1 values on their validation sets was not significant. However, when the CNN on the dual channel side of the model was replaced with a BiLSTM, the results changed significantly, indicating that it is not only the selection of features (the selection of information) but also the selection of the classifier that affects the overall results. When one side of the input is a POS feature, the CNN is able to extract the local features very well. When the other side of the input is a word2vec model, a BiLSTM model that takes into account the context is used, as the word embedding features themselves have information about the word itself. In summary, such a classifier has better experimental results and is the reason why this model is proposed in this paper.


## 2.4. PW2CNN and BiLSTMatt Models

The proposed PW2CNN and BiLSTMatt model uses the word2vec model [23] for word embedding, CNN, and BiLSTM models for classifier, and incorporates an attention mechanism. As the RNN (recurrent neural network) will lose its ability to learn long-term information, i.e., there is a long-term dependency problem, as the gradient will disappear or explode after multiple propagations with increasing input time series. For this reason, LSTM [24], is introduced into the model design. LSTM removes or adds information to the cell states through a gate structure.A bidirectional long and short-term memory network (BiLSTM) usually consists of two LSTMs connected, including a positive and a negative one. The positive LSTM captures the past information in the sentence and the negative LSTM acquires the future information in the sentence. In this way, the model is able to extract contextual information, and therefore, the prediction results of the bidirectional LSTM will be more accurate. For the problem of sentiment classification of text, the model is very suitable, as it contains all the forward and backward information in the sentence.(4)it=σWiht−1,xt+bict=ft⊙ct−1+it⊙c˜tft=σWfht−1,xt+bfot=σWoht−1,xt+boc˜t=tanhWcht−1,xt+bcht=ot⊙tanhCt.The LSTM network introduces a new internal stateinternalstatect∈RD for information transfer and outputs information to the state ht∈RD of the hidden layer bi, where ft∈0,1D, it∈0,1D, and Ot∈0,1D are three gates to control the path of information transfer and ⊙ is the product of vector elements. ct−1 is the product of vector elements. c˜t∈RD is the memory unit of the previous moment.The attention mechanism (AM) [25, 26] is inspired by the human cognitive function of extracting and receiving small portions of important information from a large amount of information and ignoring the rest. Similarly, the essence of the AM is to focus on certain key parts of the input and give them a higher weight. The hidden state of an LSTM model based on the AM at any given moment depends not only on the state of the hidden layer at the current moment and the output at the previous moment but also on the contextual features, which are obtained by a weighted average. This is calculated as follows:(a)
Calculate the attention distribution.(5)ai=pz=i∣X,q=softmaxsxi,q=expsxi,q∑Nj=1expsxi,q.(b)
A weighted average of the input information is calculated based on the attention distribution.(6)attX,q=∑Ni=1αixi=Ez∼pz∣X,qx.To calculate the attention distribution is to calculate the probability of selecting the first input vector given the query vectoraiq and the input X. Where: z∈1,N is the attention variable. The first z=ii input vector is selected; ai is the AM; sxi,qis the attention scoring function.The CNN and BiLSTM were chosen as parallel structures for the model classifier. The CNN model was able to extract a certain class of lexical features (e.g. adjectives, adverbs, nouns) that are more significant for the expression of emotions. The BiLSTM is more suitable for capturing temporal information features [27].The current state in the bidirectional LSTM should also be related to the contextual features, and the output is influenced by the weighted average of the hidden states of all moments fed into the current state through the attention mechanism. The weights in the attention mechanism are adjusted according to the difference between the output and the real situation. In fact, it can be demonstrated through this experiment that this parallel model gives the best classification results compared to the benchmark model, which not only makes full use of the different feature information but also takes advantage of the different neural network models [28, 29]. This model gives better classification results than the two-channel CNN model, suggesting that the BiLSTM model with the attention mechanism plays an important role.


## 3. Experimental Preparation

### 3.1. Data Sets

The datasets used for the experiment were sentiment data from five literary works: Don Giovanni, Boyhood, On Earth, War and Peace, and Red and Black. Table1 gives information on the number of people, who received positive reviews before and after the five works, were adapted for film and television. The sentiment of each film line was extracted using Syuzhet [30], and the sentiment indices of the novel and film lines were compared to correlate the Hurst indices of the film lines with the Rotten Tomatoes and IMDB ratings.Table 1
Information on crawled literature data.
CategoryLiterary worksFilm and television worksProportion (literature/Film)Don quixote428212183.52Childhood400225921.54On Earth462411244.11War and peace500719492.60Red and black400023321.72The results of the comparison of the number of literary works and film and television works that received positive reviews are shown in Figure5.Figure 5
Comparison of the emotional evaluation of literary works and film works.


### 3.2. Experimental Environment

In order to validate the performance metrics of the model, the comparison environment was set up as follows: Windows 64 operating system, 64 GB of memory, Intel(R) Xeon(R) CPU E5-2 650v4 @ 2.20 GHz (2 processors), and the model used the Keras deep learning framework.


### 3.3. Loss Function

The loss function used in the experiments in this paper is a cross-entropy loss function (binary cross-entropy), with the following equation.(7)loss=−∑ni=1yilgy^i+1−yilg1−y^i.where: yi is the true discrete category; y^i is the conditional probability distribution of the predicted category labels.


### 3.4. Experimental Parameters

The hyperparameters on the CNN model in this paper are set as shown in Table2.Table 2
Parameter setting of CNN.
Convolutional layerNumber of convolution kernelsConvolution kernel sizeActivation functionsConv1324 ∗ 4ReLu functionConv2164 ∗ 4ReLu functionPooling layerPooling methodsPooling kernel sizeDropout functionPool1Maximum pooling2 ∗ 20.25The PW2CNN and BiLSTMatt model puts the long memory model into a parallel structure and adds the attention mechanism, the activation function (AF) of the attention layer in the parallel structure is the softmax function, and the AF of the middle output layer is the ReLu function, and the dropout value of the attention layer is 0.3. For the model with a nonparallel structure, the FC layer and the output layer are also followed by the FC layer and the sigmoid function, respectively, with the dropout value set to 0.5 for the FC layer. The output layer is also followed by the FC layer and the output layer with the same parameters as above, mainly to maintain consistency across multiple models. Four different comparison experiments showed that the best results were obtained with the cross-entropy function as the loss function. In this case, the batch size is set to 64, and the model converges when the epoch is 10, so the epoch is set to 10.


## 3.1. Data Sets

The datasets used for the experiment were sentiment data from five literary works: Don Giovanni, Boyhood, On Earth, War and Peace, and Red and Black. Table1 gives information on the number of people, who received positive reviews before and after the five works, were adapted for film and television. The sentiment of each film line was extracted using Syuzhet [30], and the sentiment indices of the novel and film lines were compared to correlate the Hurst indices of the film lines with the Rotten Tomatoes and IMDB ratings.Table 1
Information on crawled literature data.
CategoryLiterary worksFilm and television worksProportion (literature/Film)Don quixote428212183.52Childhood400225921.54On Earth462411244.11War and peace500719492.60Red and black400023321.72The results of the comparison of the number of literary works and film and television works that received positive reviews are shown in Figure5.Figure 5
Comparison of the emotional evaluation of literary works and film works.


## 3.2. Experimental Environment

In order to validate the performance metrics of the model, the comparison environment was set up as follows: Windows 64 operating system, 64 GB of memory, Intel(R) Xeon(R) CPU E5-2 650v4 @ 2.20 GHz (2 processors), and the model used the Keras deep learning framework.


## 3.3. Loss Function

The loss function used in the experiments in this paper is a cross-entropy loss function (binary cross-entropy), with the following equation.(7)loss=−∑ni=1yilgy^i+1−yilg1−y^i.where: yi is the true discrete category; y^i is the conditional probability distribution of the predicted category labels.


## 3.4. Experimental Parameters

The hyperparameters on the CNN model in this paper are set as shown in Table2.Table 2
Parameter setting of CNN.
Convolutional layerNumber of convolution kernelsConvolution kernel sizeActivation functionsConv1324 ∗ 4ReLu functionConv2164 ∗ 4ReLu functionPooling layerPooling methodsPooling kernel sizeDropout functionPool1Maximum pooling2 ∗ 20.25The PW2CNN and BiLSTMatt model puts the long memory model into a parallel structure and adds the attention mechanism, the activation function (AF) of the attention layer in the parallel structure is the softmax function, and the AF of the middle output layer is the ReLu function, and the dropout value of the attention layer is 0.3. For the model with a nonparallel structure, the FC layer and the output layer are also followed by the FC layer and the sigmoid function, respectively, with the dropout value set to 0.5 for the FC layer. The output layer is also followed by the FC layer and the output layer with the same parameters as above, mainly to maintain consistency across multiple models. Four different comparison experiments showed that the best results were obtained with the cross-entropy function as the loss function. In this case, the batch size is set to 64, and the model converges when the epoch is 10, so the epoch is set to 10.


## 4. Experimental Results and Analysis

### 4.1. Multimodel Testing

The results of 10 experiments with the four models were compared by the method mentioned previously, and the F1 values and accurate information of the four models are given in Tables3 and 4. The BASELINE benchmark model is a word2vec + CNN model, the PWCNN is a CNN model with feature fusion, the PW2CNN model is a two-channel CNN model, and the PW2CNN and BiLSTMatt model is a parallel CNN and BiLSTM model (with attention added).Table 3
F1 values for different experimental models.
Type of experimentF1 value (%)BASELINE modelPWCNN modelPW2CNN modelPW2CNN & BiLSTMatt model10.9420.9460.9570.96020.9440.9440.9590.96330.9480.9450.9520.95440.9450.9520.9490.96150.9470.9460.9600.96360.9400.9470.9400.96370.9460.9510.9430.95080.9420.9530.9450.95590.9440.9520.9430.957100.9450.9500.9440.959Table 4
Accuracy of different experimental models.
Type of experimentAccuracy rate (%)BASELINE modelPWCNN modelPW2CNN modelPW2CNN & BiLSTMatt model10.9420.9440.9500.96420.9440.9440.9510.96330.9460.9410.9520.96240.9430.9520.9450.96150.9430.9420.9560.96360.9400.9470.9510.96270.9460.9510.9490.96080.9420.9530.9450.95790.9440.9480.9520.965100.9450.9500.9460.960A visual comparison of the F1 values of the four models is shown in Figure6, and information on the accuracy data of the different experimental models is given in Table 4.Figure 6
Comparison of the different F1 values for the four models.A visual comparison of the accuracy of four of these models is shown in Figure7.Figure 7
Comparison of the different accuracy rates of the four models.


### 4.2. Significance Tests between Different Models

The t-test is a method of significance testing that uses a small probability counterfactual method of logical reasoning to determine whether the hypothesis is valid. This test can be used to test the degree of difference between two sample means. The reason for using the t-test here is to test whether there is a difference between the experimental results of the different models. Table 5 shows the t-test values between the four models.Table 5
t-test among four models.
ModelsBASELINEPWCNNPW2CNNPW2CNN and BiLSTMattPWCNN0.13390.34580.31410.4123PW2CNN0.21280.369370.28210.3896PW2CNN and BiLSTMatt0.280090.35960.24310.4012The comparative effect of thet-test for the four models is shown in Figure 8.Figure 8
Comparison effect oft-test for the four models.At a significance level of 0.001, thepvalue of the t-test of the PW2CNN&BiLSTMatt model against the BASELINE, PWCNN, and PW2CNN models was less than 0.001. Therefore, there was a difference between the PW2CNN&BiLSTMatt and the BASELINE, PWCNN, and PW2CNN models. Models were all significantly different from each other. In other words, at a significance level of 0.001, the PW2CNN&BiLSTMatt model significantly outperformed the BASELINE, PWCNN, and PW2CNN models. In addition, the p value of the t-test of the PWCNN model against the BASELINE model (0.003 39) was less than 0.05 at a level of 0.05. Therefore, there was a difference between the PWCNN model and the BASELINE. In other words, the PWCNN is significantly better than the BASELINE model at a significance level of 0.05.


## 4.1. Multimodel Testing

The results of 10 experiments with the four models were compared by the method mentioned previously, and the F1 values and accurate information of the four models are given in Tables3 and 4. The BASELINE benchmark model is a word2vec + CNN model, the PWCNN is a CNN model with feature fusion, the PW2CNN model is a two-channel CNN model, and the PW2CNN and BiLSTMatt model is a parallel CNN and BiLSTM model (with attention added).Table 3
F1 values for different experimental models.
Type of experimentF1 value (%)BASELINE modelPWCNN modelPW2CNN modelPW2CNN & BiLSTMatt model10.9420.9460.9570.96020.9440.9440.9590.96330.9480.9450.9520.95440.9450.9520.9490.96150.9470.9460.9600.96360.9400.9470.9400.96370.9460.9510.9430.95080.9420.9530.9450.95590.9440.9520.9430.957100.9450.9500.9440.959Table 4
Accuracy of different experimental models.
Type of experimentAccuracy rate (%)BASELINE modelPWCNN modelPW2CNN modelPW2CNN & BiLSTMatt model10.9420.9440.9500.96420.9440.9440.9510.96330.9460.9410.9520.96240.9430.9520.9450.96150.9430.9420.9560.96360.9400.9470.9510.96270.9460.9510.9490.96080.9420.9530.9450.95790.9440.9480.9520.965100.9450.9500.9460.960A visual comparison of the F1 values of the four models is shown in Figure6, and information on the accuracy data of the different experimental models is given in Table 4.Figure 6
Comparison of the different F1 values for the four models.A visual comparison of the accuracy of four of these models is shown in Figure7.Figure 7
Comparison of the different accuracy rates of the four models.


## 4.2. Significance Tests between Different Models

The t-test is a method of significance testing that uses a small probability counterfactual method of logical reasoning to determine whether the hypothesis is valid. This test can be used to test the degree of difference between two sample means. The reason for using the t-test here is to test whether there is a difference between the experimental results of the different models. Table 5 shows the t-test values between the four models.Table 5
t-test among four models.
ModelsBASELINEPWCNNPW2CNNPW2CNN and BiLSTMattPWCNN0.13390.34580.31410.4123PW2CNN0.21280.369370.28210.3896PW2CNN and BiLSTMatt0.280090.35960.24310.4012The comparative effect of thet-test for the four models is shown in Figure 8.Figure 8
Comparison effect oft-test for the four models.At a significance level of 0.001, thepvalue of the t-test of the PW2CNN&BiLSTMatt model against the BASELINE, PWCNN, and PW2CNN models was less than 0.001. Therefore, there was a difference between the PW2CNN&BiLSTMatt and the BASELINE, PWCNN, and PW2CNN models. Models were all significantly different from each other. In other words, at a significance level of 0.001, the PW2CNN&BiLSTMatt model significantly outperformed the BASELINE, PWCNN, and PW2CNN models. In addition, the p value of the t-test of the PWCNN model against the BASELINE model (0.003 39) was less than 0.05 at a level of 0.05. Therefore, there was a difference between the PWCNN model and the BASELINE. In other words, the PWCNN is significantly better than the BASELINE model at a significance level of 0.05.


## 5. Conclusion

A PW2CNN and BiLSTMatt model for sentiment evaluation is proposed for mining and analyzing the sentiment of foreign literary works, using both word vectors and POS feature vectors. These two features are two ways of extracting information from textual data, mainly taking into account the characteristics of words themselves and the characteristics of features containing sentiment information. The role of lexical features in the model is verified by comparing the BASELINE model with the PWCNN model. At the same time, two options are proposed for the fusion of these two features, one is the direct splicing of two vectors and the other is the “fusion” by means of a parallel structural neural network model. A comparison is made between a CNN and a bidirectional long and short-term memory network incorporating an attention mechanism, and experimental results are presented to demonstrate which model is more suitable. The convolutional network is good at capturing local features, while the long and short-term model is more suitable for features containing “temporal” information. Since in the summary of the study of BASELINE and PWCNN models, no comparative experiments with multiple parameters were conducted, but only between models, the study of the effect of multiple parameters on experimental results will be a key direction, in future work.



---

*Source: 8237466-2022-09-13.xml*