Next Article in Journal
A Critical Realist Approach to Reflexivity in Sustainability Research
Next Article in Special Issue
MACLA-LSTM: A Novel Approach for Forecasting Water Demand
Previous Article in Journal
Digital Marketing’s Impact on Rural Destinations’ Image, Intention to Visit, and Destination Sustainability
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Community Governance Based on Sentiment Analysis: Towards Sustainable Management and Development

1
College of Information Science and Technology, Zhejiang Shuren University, Hangzhou 310015, China
2
College of Information Engineering, Zhejiang University of Technology, Hangzhou 310023, China
3
Zhejiang Economic Information Center, Hangzhou 310006, China
*
Author to whom correspondence should be addressed.
Sustainability 2023, 15(3), 2684; https://doi.org/10.3390/su15032684
Submission received: 29 November 2022 / Revised: 26 January 2023 / Accepted: 29 January 2023 / Published: 2 February 2023

Abstract

:
The promotion of community governance by digital means is an important research topic in developing smart cities. Currently, community governance is mostly based on reactive response, which lacks timely and proactive technical means for emergency monitoring. The easiest way for residents to contact their properties is to call the property call center, and the call centers of many properties store many speech data. However, text sentiment classification in community scenes still faces challenges such as small corpus size, one-sided sentiment feature extraction, and insufficient sentiment classification accuracy. To address such problems, we propose a novel community speech text sentiment classification algorithm combining two-channel features and attention mechanisms to obtain effective emotional information and provide decision support for the emergency management of public emergencies. Firstly, text vectorization based on word position information is proposed, and a SKEP-based community speech–text enhancement model is constructed to obtain the corresponding corpus. Secondly, a dual-channel emotional text feature extraction method that integrates spatial and temporal sequences is proposed to extract diverse emotional features effectively. Finally, an improved cross-entropy loss function suitable for community speech text is proposed for model training, which can achieve sentiment analysis and obtain all aspects of community conditions. The proposed method is conducive to improving community residents’ sense of happiness, satisfaction, and fulfillment, enhancing the effectiveness and resilience of urban community governance.

1. Introduction

Community is a social life community composed of people living in a certain area, which is the foundation of urban society. Community governance is the effective management of public affairs involving a community’s common interests by multiple governments and non-governmental organizations within the community. It is based on formal laws, regulations, coordination, and interaction to enhance community cohesion and promote the social welfare of community members. It also promotes the development and progress of the community and, therefore, plays a significant role in community. In recent years, digital reform of communities has been in full swing in China. Community property and governance need to coordinate cooperation among the government, community organizations, residents, and others to satisfy community needs based on market principles, public interest, and community identity. The digital reform of communities can increase community governance’s effectiveness. In the community governance scenario, residents’ service needs and guarantees are its core tasks. Once residents are dissatisfied with the community, community property needs to meet the reasonable needs of residents in time. At the same time, community property and government departments also need to analyze the emotions of residents in communication. Knowing the quality of their property services and residents’ satisfaction is beneficial. The most direct way for them is to make a call to the property call center, and the call centers of many properties store many speech data. Currently, these data are only used as information for accountability after the event, and have not been used reasonably. Therefore, the community needs the text sentiment classification method [1,2,3] to obtain effective emotional information from community residents’ speech data. Then, community property and government departments can carry out intervention response work. This achieves intelligence of society governance. Meanwhile, it improves the sense of happiness and belonging of community residents and enhances the harmonious image of the community. The method is also important for realizing the digital transformation of urban community governance and sustainable urban development.
Now, text sentiment classification is mainly achieved by rule methods, machine learning methods and deep learning methods. The rule method [4] obtains sentence feature representation through the language knowledge experience of many scholars. However, its high complexity and huge cost make it difficult to update and classify sentiment. The statistical-based machine learning method [5] uses manual labeling to label text features, leading to strong subjective awareness and low efficiency and incomplete contextual information of the context. Deep learning methods [6] can actively and fully learn contextual sentiment information and reduce the complexity of text construction, which can better achieve text sentiment classification. However, text sentiment classification algorithms need to fully integrate this feature of the corpus. In some application scenarios with a large-scale corpus, some pre-trained language models proposed by some scholars have better feature representation ability and classification effect. However, there are still the following problems:
  • Community speech text data contain rich sentiment information, and its corresponding corpus of text sentiment data is small or not even publicly available. The text emotional classification algorithm in the general field cannot learn the characteristics.
  • Community speech texts rely on the audio-to-text conversion between residents and property in the community data center, including positive and negative sentiments about service quality, service efficiency, and community environmental governance. However, these texts have problems such as conversion errors, frequent communication dialogues with staff members prone to long community texts, the traditional long text extraction method being single, and problems such as data loss and gradient explosion. These problems make it difficult to extract sentiment features from long community dialogue texts, which affects the accuracy of the sentiment classification of community speech texts.
  • In the training process of the traditional text sentiment classification model, the difficulty of classifying positive and negative sentiment samples of unbalanced community speech texts and the adjustment of training weight coefficients have yet to be considered, which will lead to low accuracy for classification models.
To accurately identify the sentiment information of community speech text, we present a model based on sentiment knowledge enhanced pre-training (SKEP), and a community speech text sentiment classification algorithm combining dual-channel features and attention mechanism (CST_SCA). The specific contributions of this paper are as follows:
  • To address the problem of the small size of community speech text sentiment corpus, we construct a sentiment knowledge enhancement pre-trained language model which extracts the joint features of sentiment information and semantics. Based on the sentiment knowledge enhancement model and community corpus, data migration and fine-tuning of the community speech text is realized, which constructs community speech text. This method can enhance the community speech text corpus’s sentiment feature representation capability.
  • To address the problem that single feature extraction method only one-sidedly considers the sentiment text information under the temporal order, we propose a dual-channel feature extraction method that integrates space and time series. Three types of features are obtained: spatial sentiment features, temporal order sentiment features, and local features. The spatial-based feature extraction method obtains the global sentiment features of community speech texts. The time-series-based feature extraction method obtains the historical and future features in the context. Consequently, emotional features in community speech texts can be fully extracted.
  • It is challenging to train a classification model under the unbalanced number of positive and negative sentiment texts. We present an improved cross-entropy loss function for community speech text to adjust the weights of the hard-to-distinguish emotional texts in the model and update the parameters. The proposed method can reduce the impact of unbalanced texts and improve the accuracy of text emotional classification.

2. Related Works

At present, many methods have been proposed for text sentiment classification, such as rule-based and dictionary-based methods [7], statistical-based machine learning methods [8], and deep learning [9]. As shown in Table 1, some scholars focus on rules-based and dictionary-based methods. For example, Vashishtha, S. et al. [10] use a novel set of fuzzy rules involving multiple dictionaries and datasets to classify posts into positive, negative, or neutral sentiment categories to calculate the sentiment of social media posts. Consli, S. et al. [11] propose a sentiment analysis method based on fine-grained aspects using sentiment dictionary-based and semantic polarity rules. In order to identify sentiments associated with specific topics of interest in each sentence, the method assigns real-valued polarity scores between −1 and +1 to these topics. Guixian Xu et al. [12] construct an extended sentiment dictionary that contains base sentiment words, domain sentiment words, and multi-sense sentiment words, thus improving the accuracy of sentiment analysis. Therefore, some scholars focus on using statistical-based machine learning methods to achieve text sentiment classification. For example, Huiliang Zhao et al. [13] consider sequence length, text order changes and complex logic, and propose an optimized machine learning algorithm to analyze the sentiment of online reviews. Hamada Nayel et al. [14] propose a supervised machine learning algorithm based on a support vector machine. The algorithm realizes automatic sarcasm detection and sentiment analysis of internet user comments to obtain user emotional state and internet public opinion status. However, the statistical-based machine learning methods in [13,14] need to rely entirely on the pre-manual feature selection and labeling. Simultaneously, the selection of the sentiment feature is demanding and complicated.
To solve the above problems, the selection of sentiment features and the construction of related corpus are considered. After a short while, some scholars focus on deep learning based automated emotional feature learning methods. For example, Dongliang Xu et al. [15] propose a microblog sentiment classification model based on a convolutional neural network. The word2vec neural network model is introduced, the distributed word embedding of each word is trained, and the trained word vector is used as the input feature of the model. Then, the microblog text features are learned through parallel convolutional layers with multiple convolution kernels of different sizes, and the sentiment polarity is outputted. Mohammad EhsanBasiri et al. [16] propose an attention-based bidirectional deep model. The method extracts past and future contexts by considering the temporal information flow in two directions, passes the attention mechanism, and outputs the sentiment classification results. Faliang Huang et al. [17] propose a text emotion detection model. That is, by integrating emotional intelligence, an emotion-enhancing LSTM (Long Short-term Memory) is designed to improve the emotional feature learning ability of the network. Additionally, then, the topic-level attention mechanism is combined to effectively detect text sentiment. The deep learning-based text sentiment classification algorithms in [15,16,17] can effectively learn text sentiment features to achieve text sentiment classification in their respective domains. However, there are still data sets missing or even no data sets for feature fields.
In addition to poor scalability, some scholars focus on using transfer learning-based methods for data set pre-training. For example, Puneet Kumar et al. [18] use a pre-trained language model BERT based on the bidirectional Transformer encoder structure for pre-training, which uses CNN for feature extraction and BiLSTM to extract text order and sequence-related information. The two networks are spliced and sent to the sentiment classification module to realize sentiment classification. Yu Sun et al. [19] propose an enhanced representation model, ERNIE, based on knowledge integration. This can enhance the general semantic representation ability by uniformly modeling the lexical structure, grammatical structure, and semantic information in the training data. Hao Tian et al. [20] propose an emotion pre-training language model SKEP based on emotion knowledge augmentation. With the help of automatically mined knowledge based on the statistic method, SKEP mines the sentiment knowledge, including sentiment words, sentiment word polarity, and attribute word-sentiment word collocation binary. Additionally, then, the sentiment analysis task is applied to the pre-training process of the model in combination with multi-granularity, thus realizing the multi-task sentiment analysis. Although [18,19,20] can combine pre-trained language models for general sentiment tasks, fewer research results are available for text sentiment classification algorithms for community speech where a large-scale corpus does not exist. Consequently, it is difficult to realize the textual classification of community speech accurately and efficiently.

3. Algorithm Principle

This section presents our community speech text sentiment classification algorithm, combining dual-channel features and attention mechanism, which converts unstructured data into structured data with high efficiency. Figure 1 shows the schematic diagram of the classification algorithm. Firstly, massive community speech texts are read from the data center to construct emotional datasets and training sets. Secondly, community speech texts are vectorized to generate an input format that can be acceptable to the subsequent model. Based on SKEP, an emotional knowledge-enhanced pre-trained language model is constructed afterward. Moreover, fine-tuning is utilized for sentiment information transmission from layer to layer. Then, the feature extraction in the space and time series is realized by the dual-channel method. After that, an attention-based local feature extraction is performed on the extracted community speech and text features. In order to balance the positive and negative community speech texts, the weight coefficients are adaptively adjusted to pay more attention to the emotional feature representation with a small number.

3.1. Community Speech Text Acquisition

The community speech data are obtained from the community’s call center system and converted into text by a speech-to-text tool to build a data set. The community property and government departments mainly focus on residents’ complaints about various types of information, and the positive and negative information brings a certain impact to the society. Therefore, the method focuses on the positive and negative emotional information of residents and their speech data. Then, it provides decision support for property, community and government and creates a good community governance environment by intervening in advance. At the same time, according to the sentiment classification method mentioned in the literature [3,7,10,12,21], we divide community speech text data into positive and negative categories. Then, the data of each community speech text is divided into two categories: positive and negative. For example, praises such as “good quality of community property services and regular cleaning of the property is very clean” are classified as positive labels. Complaints such as “the environmental damage caused by the accumulation of garbage in a certain place, and the community often have water leakage” are classified as negative labels.

3.2. Construction of Classification Model Based on Sentiment Text Knowledge Enhancement

3.2.1. Text Vectorization Combined with Location Information

In language processing, the input of emotional feature extraction, model training, and classification should be text vectors. Word embedding, which combines the word order relationship and location information, can be an efficient text vectorization. Firstly, let S = { S 1 , S 2 , , S l , , S n } , S l = { x 1 l , x 2 l , , x i l , , x m l } , where S denotes the set of all community speech texts, S l denotes the l-th community speech text sequence, x i l denotes the i-th character in the l-th community speech text sequence, n is the number of sequences in the community speech text collection, and m is the number of characters in the l-th community speech text sequence. We argue that the character position information in the process of sentiment analysis will cause semantic inconsistency, which will affect the judgment of sentiment. Therefore, the vector of each character E ( x i l ) and the position vector P ( x i l ) are obtained separately from the community speech text sequence S l . The position vector P ( x i l ) is given by:
P ( x i l ) = { sin ( p o s / 10000 2 i / d mod e l ) ,   i   is   odd cos ( p o s / 10000 2 i / d mod e l ) ,   i   is   even
where pos denotes the specific location of the community speech text x i l in the text sequence, i denotes vector dimension, and d mod e l denotes the 512-dimensional vector accepted by the emotional knowledge enhancement model. Next, the 512-dimensional vectors E ( x i l ) and P ( x i l ) are summed to obtain the text input vector T l , which is used as the input to the subsequent model and is calculated as follows:
T l ( x i l ) = E ( x i l ) + P ( x i l ) , x i l S l
where T l ( x i l ) denotes the input vectors required for the subsequent sentiment knowledge enhancement model obtained by combining community speech text x i l word embedding and position vector embedding. Additionally, then the model constitutes a community speech text vector set T = { T 1 , T 2 , , T l , , T n } .

3.2.2. Community Corpus Construction Based on SKEP

Due to the presence of rich sentiment feature representation in the community speech text input vector Tl, we consider SKEP as a pre-trained language model with sentiment knowledge enhancement which can be used to construct a pre-trained language model based on SKEP by using sentiment feature information in a multi-granularity manner. In this way, a pre-trained language model based on emotional knowledge augmentation is constructed. With the problem of small corpus, the relevant features of other datasets are utilized to migrate and fine-tune the data. Therefore, a corpus of community speech texts based on SKEP can be obtained to increase the sentiment feature representation. The details are as follows.
The sentiment words, polarity, and attribute word-sentiment word pairing binary in the text are masked by SKEP. Meanwhile, the multi-granularity method is used to optimize the emotional pre-training objective function F, which contains the attribute word-sentiment word pair loss function F a s p , the emotional word loss function F s w and the polarity loss function F w p . Thus,
F = F s w + F w p + F a s p
where F denotes the sentiment pre-training objective optimization function for multiple sentiment tasks. This objective function can be used to build a SKEP-based corpus. Finally, we combine the community speech text corpus to obtain the final output set X = { X 1 , X 2 , , X l , , X n } of the community speech text sentiment enhancement model.

3.2.3. Dual-Channel Sentiment Text Feature Extraction

The community speech texts, with positive and negative emotions, provide rich information from the perspective of feature extraction. Traditional neural networks, such as the Bi-Gated Recurrent Unit [22], can only extract emotional text information in time series. As shown in Figure 2, our dual-channel emotional text feature extraction method integrates the space and time series, combining the spatial-based feature extraction method (Convolutional Neural Network, CNN) and the time-based feature extraction method (BiGRU). Meanwhile, the spatial and temporal extracted sentiment text features are used for local feature extraction by attention mechanism. It is beneficial to obtain key emotional information in the dialogue between community residents and staff, and fully grasp the emotional dynamics of community residents. The details are as follows:
The sentiment vector X l of the SKEP-based corpus is inputted for spatial and time-series feature extraction, respectively, as in Formula (4). Firstly, the community speech text is inputted into the space-based feature extraction channel, and the text vector is computed by convolving the convolution kernel in the convolution layer. Simultaneously, different convolution kernel sizes enable the model to enrich the community speech text in different spaces.
c l = r e l u ( W h ( X α l : X a + h 1 l ) + b h )
where c l denotes the text convolution sentiment feature value after convolution operation, relu() denotes activation function, W h , b h denote the weight value and bias value during the convolution operation, and X α l : X a + h 1 l denotes the vector consisting of the h words adjacent to the a-th word in the l-th community speech text under each convolution kernel. Secondly, the feature sampling is achieved by maximum pooling, and the traversal calculation is performed to obtain the emotional space feature representation set C = { c 1 , c 2 , , c l , , c n } .
Subsequently, we input the community speech text into the feature extraction channel based on time series and obtain the transmitted hidden state h l 1 and the current text input vector X l of the l-th item. According to the hidden state vector o l and o l , which is outputted by the forward and reverse GRU, all hidden feature vectors h l in the community speech text set X are calculated by Formula (10). The emotional time series feature set H = { h 1 , h 2 , , h l , , h n } is obtained.
h l = p 1 o l + p 2 o l + b l
where p 1 denotes the weight corresponding to the forward GRU of the l-th information text, p 2 denotes the weight corresponding to the reverse GRU of the l-th information text, b z presents the offset of the l-th information text, and h l denotes the hidden feature vector after weighted summation.
By the above methods, the emotional space feature vector set C and the time series feature vector set H of community speech texts are obtained, respectively. Utilizing the attention mechanism, the local feature can be fully extracted on the basis of the space and time series. The corresponding scores are calculated by Formulas (6) and (7), respectively:
s l j C = v 1 T tan h ( m 1 c l 1 + m 2 c l )
s l j H = v 2 T tan h ( m 3 h l 1 + m 4 h l )
where s l j C denotes the score of the j-th word of the l-th text in the emotional space feature vector set C. s l j H denotes the score of the j-th word of the l-th emotional text in the emotional time series feature vector set H. v 1 T , v 2 T , m 1 , m 2 , m 3 , and m 4 denote the weight vector learned by the attention mechanism. The Softmax function is used to generate the corresponding weights according to the scores after all the calculation results. The new feature vectors are calculated using the following formulas:
m l C = j = 1 n s o f t max ( s l j C ) c l
m l H = j = 1 n s o f t max ( s l j H ) h l
where m l C denotes the spatial feature vector of the l-th text after the attention mechanism update and m l H denotes the time-series feature vector of the l-th text after the attention mechanism update. Next, the two feature vectors are concatenated as:
m l = c o n c a t ( m l C , m l H )
where concat() denotes concatenation of the two feature vectors. Finally, the emotional feature set of the dual-channel community speech texts M = { m 1 , m 2 , , m l , , m n } is obtained by traversing the calculation and splicing.

3.2.4. Classification Model Training Based on Improved Cross-Entropy Loss Function

Note that with the current traditional cross-entropy loss function it is difficult to classify community speech texts with errors and sparse emotional features. Therefore, an improved cross-entropy loss function method is proposed to adjust the weights adaptively. It focuses more on the hard-to-classify and misclassified texts during the training process, which improves the robustness of the model. This cross-entropy loss function can be given by:
L = W l ( m l + log ( u n exp ( m ε ) ) )
where W l denotes the weight coefficients of the classification model, m l denotes the emotional feature vector of the l-th community speech texts which is outputted in the previous section, and n denotes the total number of community speech texts. The weight adjustment coefficients are used to adjust the proportion of positive and negative community sentiment texts and reduce the loss of hard-to-classify samples, thus adjusting the classification sentiment weights of community speech texts. During the training process, the loss values corresponding to the predicted probabilities by all sentiment feature vectors are iteratively calculated. When the value of the loss function is greater than the threshold ε , the model parameters are updated and training continues. Otherwise, the minimum loss function value of the model is outputted.

4. Algorithm Implementation

CST_SCA can perform sentiment classification of community speech texts. The specific steps of Algorithm 1 are as follows and the algorithm flow chart is shown in Figure 3. Among them, let us take the loss function value as θ , the loss function as loss(), and the number of convolution kernels as kernel. Firstly, CST_SCA initializes key parameters such as text vector length as maxlength, processing batch size as batchsize, learning rate as learningrate, dimension as dim. Afterwards, model pre-training is performed on the obtained community speech and text vectors. Additionally, then, emotional text feature enhancement is performed to obtain the emotionally enhanced community speech text vector. Secondly, the dual-channel emotional text feature extraction method is adopted. The feature extraction method based on the space and time series is used to extract the features of the community speech text vector in the space and time series. This way, the community speech texts’ global and contextual sentiment feature information is obtained. Then, the attention mechanism is used to extract local features according to the output feature vector, and thereafter the sentiment vectors are outputted by the two channels spliced. Immediately after, the model is trained by an improved cross-entropy loss function method applied to community speech text. In summary, the situation is judged as follows: if this loss function value is less than the threshold value, the corresponding loss function value is calculated by returning; on the other hand, the loss function value is calculated iteratively, and the corresponding output of the model is obtained. Cycling the above steps to classify and obtain the sentiment information provides residents’ sentiment data support for intelligent and sustainable community governance.
Algorithm 1: Community Speech Text Sentiment Classification Algorithm Combining Dual-Channel Features and Attention Mechanism
Input:community speech text data
Output:labels corresponding to all community speech texts data
1: maxlength = 256; batchsize = 8; kernel = [3,4,5]; learningrate = 5 × 10−5; dim = 1024;
2: while 1
3:  Perform pre-training model and vectorize text on the obtained community speech text;
4:   for i = 1, 2, …,   e p o c h  do
5:    Perform pre-training model on the obtained community speech text;
6:    for i = 1, 2, …,   N  do
7:  if (i ≤  N ) then
8:   Perform text vectorization on each piece of community speech and text, and enhance the emotional features of community speech and text;
9:   end if
10:  end for
11:    for i = 1, 2, …,   N  do
12:   if (i ≤ N ) then
13:   Extract sentiment of community speech texts through space-based feature extraction methods;
14:   Extract sentiment from community speech and text through time-series-based feature extraction method;
15:   Output the feature vectors by the dual-channels are combined with the attention mechanism to extract local features;
16:   Stitch the extracted results together;
17:   end if
18:  end for
19:  Train the model through an improved cross-entropy loss function method suitable for community speech text;
20:  for i = 1, 2,…, N  do
21:   if (i ≤ N ) then
22:     θ = θ loss ( i ) ;
23:    if ( θ   ε ) then
24:     Output the label corresponding to the community speech text;
25:    end if
26:   end if
27:  end for
28:    end

5. Algorithm Analysis

5.1. Experimental Data and Parameters

Currently, there are no publicly available and accessible resources for annotated datasets in the community domain. The data of this research come from many authentic user dialogue texts of the community property center system provided by several cooperative enterprises. The attributes of collected single dialogue text include community environment, governance effects, attitudes, and opinions of residents’ comments. The text mainly obtains the real estate consultation speech data of community owners online through the call center system platform, which uses speech recognition to convert the speech into text data. There are 9089 user conversation texts in total. From the perspective of community environmental governance, this paper conducts sentiment analysis on residents’ comment text data to assist community staff in precise governance. The parameters used in the experiment are shown in Table 2.
To evaluate the performance of CST_SCA, A (accuracy), P (precision), R (recall) and F1 value are introduced, which are given by:
A = T P + T N T P + T N + F P + F N
P = T P T P + F P
R = T P T P + F N
F 1 = 2 P R P + R
where TP denotes the number of positive categories with correct classification results, TN denotes the number of negative categories with correct classification results, FP denotes the number of positive categories with wrong classification results, and FN denotes the number of negative categories with wrong classification results.

5.2. Results and Discussion

5.2.1. Parameter Selection Analysis

The training times are chosen as 0, 2, 4, 6, 8, 10, and the experimental parameters in Table 2 are chosen. We used them to analyze the effect of the training epoch of CST_SCA on accuracy. As shown in Figure 4, the accuracy of CST_SCA in classifying the sentiment of community speech text keeps increasing when the number of training times keeps increasing. The accuracy tends to level off when training times reach eight and above. CST_SCA adopts the updated learning rate method. In the initial stage, the learning rate of CST_SCA is large, then CST_SCA can fully learn the text’s emotional information. The learning rate decreases continuously with increasing training times, and its accelerated convergence reaches the optimal value. In contrast, CST_SCA uses an optimizer to update and decay all parameters in training, which can speed up its convergence speed. This makes CST_SCA have better classification accuracy after the training times reaches eight. Therefore, CST_SCA can fully learn the sentiment information in the text at the early stage, and the model accelerates convergence and achieves better accuracy as the number of trainings continues to increase.
The weight coefficient β a in the loss function is chosen as 0.2, 0.4, 0.6, 0.8, the weight coefficient β b is set as 0.2, 0.4, 0.6, 0.8, and the experimental parameters in Table 2 are chosen. We use them to analyze the influence of weight coefficients in CST_SCA on the accuracy of text sentiment classification. As shown in Figure 5, when β a is 0.6 and β b is 0.6, the text sentiment classification accuracy of CST_SCA reaches the maximum. With increasing β a , the weight of community speech text in the positive category increases accordingly. Thus, the full learning of the community speech text features in the positive category is enhanced during the training process to improve the classification accuracy of the positive category. With the increase of β b , the weight of community speech texts in the negative category increases and the CST_SCA can pay sufficient attention to the community speech texts in the negative category that are difficult to distinguish and misclassify. Therefore, this gradually improves the robustness and accuracy of CST_SCA. However, when β a is larger than 0.6, the positive category-irrelevant features will retain, which causes a certain decrease in accuracy. If β b is too large, it will cause the overfitting of the negative categories in the community speech and text, affecting the accuracy. Consequently, it will be impossible to ensure the correct classification of the community speech and text, and will ultimately reduce the accuracy of the sentiment classification of the community speech and text. Therefore, CST_SCA set β a as 0.6 and β b as 0.6, which can achieve better classification of the community speech text.

5.2.2. Algorithm Experiment

To investigate the effectiveness of each module in the proposed CST_SCA model for community speech text sentiment classification, we conducted ablation studies including SKEP, SKEP-TextCNN, and SKEP-BiGRU on the classification metrics.
Only SKEP pre-trained language models are used to analyze the impact on the sentiment classification metrics of community speech texts to investigate the different modules’ effectiveness. As shown in Table 3, with the continuous increase of training times, the accuracy and precision have been improved to a certain extent but it fails to achieve better results. In the initial training stage, combined with the SKEP pre-trained language model to fine-tune the community speech and text, the features can be learned to a certain extent. However, due to the long experimental text information, the key feature of emotion in the community speech text cannot be extracted for classification, resulting in the problem of poor classification accuracy and precision. Therefore, the feature extraction module is a significant part of the community speech text sentiment and directly affects the classification metrics.
The SKEP-TextCNN model is used to analyze the impact of sentiment classification indicators on community speech texts. As shown in Table 4, the accuracy and precision have improved with the continuous increase in training compared with the SKEP pre-trained language model. The SKEP pre-trained language model can improve semantic analysis ability in the community speech text learning and training stage. In the meantime, different convolutional kernels are used for feature extraction, which can show better feature extraction ability in the spatial dimension. In turn, the index of text sentiment classification subsequently rises. However, it is limited to the emotional feature extraction of the spatial dimension. It does not consider the front and back feature information under the time series, failing to match the relationship between the front and back semantics. The relationship between characters is not further obtained for the extracted emotional features. Therefore, the features of the extraction module need further improvement.
The SKEP-BiGRU model is used to analyze the impact of sentiment classification. As shown in Table 5, with the increasing number of training sessions, there is a further improvement in accuracy and precision compared to using only the first two models. On the premise of combining community speech and text, the SKEP pre-trained language model is fine-tuned to obtain strong semantic feature representation ability. At the same time, BiGRU is used to extract features based on time series conditions and fully obtain the semantic feature information of emotional text context. This lays the foundation for the sentiment classification of community speech and text, and the index of community speech and text sentiment classification subsequently rises. Compared to TextCNN, the feature extraction representation capability under the temporal order is slightly better than the spatial. However, some limitations still affect the community speech text sentiment classification metrics. Therefore, it is vital to combine temporal and spatial feature extraction effectively.

5.2.3. Algorithm Performance Comparison

We randomly divide the dataset into 5:5, 6:4, 7:3 and 8:2 training and testing sets, which are named EM1, EM2, EM3, and EM4. Meanwhile, we choose other parameters in Table 2 to analyze the impact of sentiment classification accuracy in different community speech texts. As shown in Figure 6, regardless of the variation in the community speech text dataset, the accuracy in CST_SCA is significantly better than in ERNIE, BEL(BERT-Bilstm), and ELA(ERNIE-Bilstm-Attention). The reason is that CST_SCA can fully integrate the emotional features of community speech and text for pre-training and, at the same time, based on different subspace and time sequence conditions, a feature of community speech and text information is extracted. This is conducive to further grasping each community speech text’s local emotional features to improve the accuracy of community speech text sentiment classification. Although ERNIE and BEL can have some training to learn the semantic information and grammatical structure of emotion in community speech text in pre-training, they do not have the corresponding fusion for specific emotion features. Moreover, ERNIE did not perform feature extraction, resulting in the inability to effectively classify some of the community speech texts, so its accuracy rate is the lowest [18,19,20].
Figure 7 illustrates the precision of different methods in sentiment classification. As shown in Figure 7, regardless of the variation in the community speech text dataset, precision in CST_SCA is significantly better than the precision in ERNIE, BEL, and ELA. The reason is that CST_SCA extracts the emotional feature information of the community speech text in different subspaces and the emotional feature information of the context in the time series through dual-channel feature extraction, which extracts emotional features comprehensively. Furthermore, combined with the attention mechanism, the emotional feature information of each text set is further weighted and summed, which is beneficial to fully extract the local emotional features of the text in space and context. However, ERNIE only learns community speech and text in the early stage through pre-training, which has great limitations for subsequent classification. Moreover, the excessive number of parameters and lopsided extraction [13,17] of LSTM in BEL and ELA lead to the risk of overfitting in the training learning process and the learning of some irrelevant information. Consequently, it affects the accuracy of community speech text sentiment classification.
Figure 8 shows the recall of different methods in sentiment classification. As shown in this figure, regardless of the variation in the community speech text dataset, recall in CST_SCA is significantly better than the recall in ERNIE, BEL, and ELA. The reason is that the sentiment weight of the text is adjusted by an improved loss function to increase the weight of hard-to-classify and misclassified text. This adjustment makes the model focus more on hard-to-classify and misclassified community speech text in the training process. Moreover, the robustness of the model is improved, which improves the recall rate of the community speech text sentiment classification. Consequently, CST_SCA has the highest recall rate for community speech text sentiment classification. The number of model parameters in ERNIE is small. Although it can improve the recall rate of the community speech text sentiment classification, the improvement is limited. Although BEL and ELA can extract some key sentiment information, they do not consider the difficult and misclassified community speech text.
In short, regardless of the changes in the community speech text dataset, CST_SCA can classify more accurate positive and negative sentiment texts and give better weight parameters, as much as possible. It improves the accuracy, recall, and F1 value of community sentiment text classification, which is better than ERNIE, BEL, and ELA.

6. Conclusions

The property management staff only passively accept the speed information of a single resident at the time, and cannot consider the status of the dial-in residents’ complaints. They only give feedback after the incident occurs. It is difficult to identify and deal with the emotional state of the residents’ complaints at the time, and the current methods are prone to excessive behavior. Therefore, sentiment analysis can provide the emotional state of the residents in real time when residents call the property. It can reduce the subjectivity of human judgment, and provide data support for community governance such as emergency intervention, service quality analysis of property, and resource allocation optimization of community. Sentiment analysis improves community property service management and enhances residents’ happiness, sense of gain and satisfaction. It can provide sustainable decision-making for community governance.
Therefore, this paper discusses the text sentiment classification method focusing on community governance according to the speech data of residents. Currently, the rule method has high complexity and huge costs, and it is difficult to update and classify sentiment. The statistical-based machine learning method has strong subjective awareness, low efficiency, and incomplete contextual information. Deep learning methods can achieve better text sentiment classification but still face problems with community speech text data, such as the corpus of text sentiment data, conversion errors, long community texts, and low accuracy of classification models. In this paper, we focus on a community speech text sentiment classification algorithm (CST_SCA) with joint dual-channel features and attention mechanism. Firstly, to overcome the lack of relevant corpora and the lack of perspectives from residents, we construct a sentiment text enhancement model based on the SKEP pre-trained language model to increase the sentiment feature representation. Secondly, to address the problem that single feature extraction method only one-sidedly considers the sentiment text information under the temporal order, we propose a dual-channel emotional text feature learning method by combining the information of textual emotional features in the community speech text corpus. This method performs sentiment feature extraction from spatial and time-series perspectives and combines attention mechanisms for local sentiment feature extraction. Additionally, then, to address the problem of unbalanced data, we propose an improved cross-entropy loss function method to reduce misclassified texts.
CST_SCA improves the performance of sentiment analysis in real community scenarios and provides data support for community governance, which promotes the digital transformation of community governance. Furthermore, it has the potential to promote sustainable decision-making for the community. Simultaneously, it can be applied to community speech text sentiment classification tasks in other application scenarios with small-scale corpus, such as service quality analysis of property. However, CST_SCA classifies sentiment information at the aspect level and does not focus on the sentiment information of specific entities in attributes. Therefore, the next stage is to investigate finer-grained sentiment classification.

Author Contributions

Conceptualization, K.W.; methodology, X.Z.; formal analysis, Q.W. and K.M.; investigation, Z.W. and Y.C.; writing—original draft preparation, X.Z., Z.Y. and K.W.; writing—review and editing, Q.W. and K.M.; supervision, Y.C. and Z.W. All authors have read and agreed to the published version of the manuscript.

Funding

This research was funded by the Public Welfare Technology Application and Research Projects of Science and Technology Department of Zhejiang Province of China under Grants No. LGF22F020006, and the “Ling Yan” Research and Development Project of Science and Technology Department of Zhejiang Province of China under Grant No.2022C03122.

Institutional Review Board Statement

Not applicable.

Informed Consent Statement

Not applicable.

Data Availability Statement

Not applicable.

Acknowledgments

We would like to thank the editor and the reviewers for their kind help in improving the manuscript.

Conflicts of Interest

The authors declare no conflict of interest.

References

  1. Zheng, S.; Cao, W.; Xu, W.; Bian, J. Revisiting the evaluation of end-to-end event extraction. In Findings of the Association for Computational Linguistics, Proceedings of the ACL-IJCNLP 2021, Virtual Event, 1–6 August 2021; Association for Computational Linguistics: Stroudsburg, PA, USA, 2021; pp. 4609–4617. [Google Scholar]
  2. Saura, J.R.; Palos-Sanchez, P.; Grilo, A. Detecting indicators for startup business success: Sentiment analysis using text data mining. Sustainability 2019, 11, 917. [Google Scholar] [CrossRef]
  3. Reyes-Menendez, A.; Saura, J.R.; Filipe, F. Marketing challenges in the #MeToo era: Gaining business insights using an exploratory sentiment analysis. Heliyon 2020, 6, 03626–03637. [Google Scholar]
  4. Hutto, C.; Gilbert, E. Vader: A parsimonious rule-based model for sentiment analysis of social media text. In Proceedings of the International AAAI Conference on Web and Social Media, Ann Arbor, MI, USA, 1–4 June 2014; Volume 8, pp. 216–225. [Google Scholar]
  5. Van Atteveldt, W.; Van der Velden MA, C.G.; Boukes, M. The validity of sentiment analysis: Comparing manual annotation, crowd-coding, dictionary approaches, and machine learning algorithms. Commun. Methods Meas. 2021, 15, 121–140. [Google Scholar] [CrossRef]
  6. Nassif, A.B.; Elnagar, A.; Shahin, I.; Henno, S. Deep learning for Arabic subjective sentiment analysis: Challenges and research opportunities. Appl. Soft Comput. 2021, 98, 106836–106862. [Google Scholar] [CrossRef]
  7. Li, R.; Lin, Z.; Lin, H.; Wang, W.; Meng, D. Text Emotion Analysis: A Survey. J. Comput. Res. Dev. 2018, 55, 30–52. [Google Scholar]
  8. Estrada ML, B.; Cabada, R.Z.; Bustillos, R.O.; Graff, M. Opinion mining and emotion recognition applied to learning environments. Expert Syst. Appl. 2020, 150, 113265. [Google Scholar] [CrossRef]
  9. Ahmad, S.; Asghar, M.Z.; Alotaibi, F.M.; Awan, I. Detection and classification of social media-based extremist affiliations using sentiment analysis techniques. Hum.-Cent. Comput. Inf. Sci. 2019, 9, 1–23. [Google Scholar]
  10. Vashishtha, S.; Susan, S. Fuzzy rule based unsupervised sentiment analysis from social media posts. Expert Syst. Appl. 2019, 138, 112834. [Google Scholar] [CrossRef]
  11. Consoli, S.; Barbaglia, L.; Manzan, S. Fine-grained, aspect-based sentiment analysis on economic and financial lexicon. Knowl.-Based Syst. 2022, 1, 108781–108795. [Google Scholar] [CrossRef]
  12. Xu, G.X.; Yu, Z.; Yao, H.; Li, F.; Meng, Y.; Wu, X. Chinese text sentiment analysis based on extended sentiment dictionary. IEEE Access 2019, 1, 43749–43762. [Google Scholar] [CrossRef]
  13. Zhao, H.; Liu, Z.; Yao, X.; Yang, Q. A machine learning-based sentiment analysis of online product reviews with a novel term weighting and feature selection approach. Inf. Process. Manag. 2021, 58, 102656–102670. [Google Scholar] [CrossRef]
  14. Nayel, H.; Amer, E.; Allam, A.; Mohammed, H. Machine learning-based model for sentiment and sarcasm detection. In Proceedings of the Sixth Arabic Natural Language Processing Workshop, Kyiv, Ukraine, 9 April 2021; pp. 386–389. [Google Scholar]
  15. Xu, D.; Tian, Z.; Lai, R.; Kong, X.; Tan, Z.; Shi, W. Deep learning based emotion analysis of microblog texts. Inf. Fusion 2020, 64, 1–11. [Google Scholar] [CrossRef]
  16. Basiri, M.E.; Nemati, S.; Abdar, M.; Cambria, E.; Acharya, U.R. ABCDM: An attention-based bidirectional CNN-RNN deep model for sentiment analysis. Future Gener. Comput. Syst. 2021, 115, 279–294. [Google Scholar] [CrossRef]
  17. Huang, F.; Li, X.; Yuan, C.; Zhang, S.; Zhang, J.; Qiao, S. Attention-Emotion-Enhanced Convolutional LSTM for Sentiment Analysis. IEEE Trans. Neural Netw. Learn. Syst. 2021, 33, 4332–4345. [Google Scholar] [CrossRef] [PubMed]
  18. Kumar, P.; Raman, B. A BERT based dual-channel explainable text emotion recognition system. Neural Netw. 2022, 2, 392–407. [Google Scholar] [CrossRef] [PubMed]
  19. Sun, Y.; Wang, S.; Li, Y.; Feng, S.; Tian, H.; Wu, H.; Wang, H. Ernie 2.0: A continual pre-training framework for language understanding. In Proceedings of the AAAI Conference on Artificial Intelligence, New York, NY, USA, 7–12 February 2020; Volume 34, pp. 8968–8975. [Google Scholar]
  20. Tian, H.; Gao, C.; Xiao, X.; Liu, H.; He, B.; Wu, H.; Wang, H.; Wu, F. SKEP: Sentiment knowledge enhanced pre-training for sentiment analysis. In Proceedings of the Association for Computational Linguistics 2020 (ACL2020), Virtual, 4 July 2020; pp. 1–10. [Google Scholar]
  21. Brauwers, G.; Frasincar, F. A survey on aspect-based sentiment classification. ACM Comput. Surv. 2022, 55, 1–37. [Google Scholar] [CrossRef]
  22. Zhu, Q.; Zhang, F.; Liu, S.; Wu, Y.; Wang, L. A hybrid VMD–BiGRU model for rubber futures time series forecasting. Appl. Soft Comput. 2019, 84, 105739. [Google Scholar] [CrossRef]
Figure 1. CST_SCA schematic.
Figure 1. CST_SCA schematic.
Sustainability 15 02684 g001
Figure 2. Dual-channel emotional text feature extraction.
Figure 2. Dual-channel emotional text feature extraction.
Sustainability 15 02684 g002
Figure 3. Algorithm flow chart.
Figure 3. Algorithm flow chart.
Sustainability 15 02684 g003
Figure 4. Effect of training times on accuracy.
Figure 4. Effect of training times on accuracy.
Sustainability 15 02684 g004
Figure 5. Effect of loss function weighting parameters on accuracy.
Figure 5. Effect of loss function weighting parameters on accuracy.
Sustainability 15 02684 g005
Figure 6. Accuracy comparison of each algorithm under different sentiment samples.
Figure 6. Accuracy comparison of each algorithm under different sentiment samples.
Sustainability 15 02684 g006
Figure 7. Precision comparison of each algorithm under different sentiment samples.
Figure 7. Precision comparison of each algorithm under different sentiment samples.
Sustainability 15 02684 g007
Figure 8. Recall comparison of each algorithm under different sentiment samples.
Figure 8. Recall comparison of each algorithm under different sentiment samples.
Sustainability 15 02684 g008
Table 1. Summary of Sentiment methods.
Table 1. Summary of Sentiment methods.
LiteratureSentiment
Methods
Learning
Paradigm
Sentiment
Task
[10]rule-based and
dictionary-based
methods
a novel fuzzy rule involving multiple dictionaries and datasetssocial media posts
[11]sentiment dictionary based and semantic polarity ruleseconomic and financial lexicon
[12]extended sentiment dictionaryChinese
dictionary
[13]statistical-based machine learning methodsoptimized machine learning
algorithm
online reviews
[14]supervised machine learning algorithm based on support vector machineinternet public opinion status
[15]deep learning-based text sentiment classification methodsCNN_Text_Word2vecmicroblog
[16]attention-based bidirectional deep modeltwitter dataset
[17]attention–emotion-enhanced convolutional LSTMsocial networking (online)
[18]transfer learning-based methodsBERT_CNN_BiLSTManalyze the inter- and intra-cluster distances and the intersection of these clusters
[19]ERNIE 2.0GLUE benchmarks and several similar tasks in Chinese
[20]SKEPsentence-level
aspect-level
opinion role
Table 2. Experimental parameter table.
Table 2. Experimental parameter table.
ParameterValue
max length256
dim1024
batch size8
dropout0.1
learning rate5 × 10−5
convolution kernel size[2,3,4]
Table 3. Impact of SKEP model on classification index.
Table 3. Impact of SKEP model on classification index.
Epoch0246810
A0.440.590.650.70.730.75
P0.420.550.650.710.770.77
Table 4. Impact of the SKEP-TextCNN model on classification index.
Table 4. Impact of the SKEP-TextCNN model on classification index.
Epoch0246810
A0.480.640.730.780.810.82
P0.510.670.740.790.820.84
Table 5. Impact of SKEP-BiGRU model on classification index.
Table 5. Impact of SKEP-BiGRU model on classification index.
Epoch0246810
A0.560.690.80.840.860.87
P0.630.750.830.850.880.88
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

Zhang, X.; Yan, Z.; Wu, Q.; Wang, K.; Miao, K.; Wang, Z.; Chen, Y. Community Governance Based on Sentiment Analysis: Towards Sustainable Management and Development. Sustainability 2023, 15, 2684. https://doi.org/10.3390/su15032684

AMA Style

Zhang X, Yan Z, Wu Q, Wang K, Miao K, Wang Z, Chen Y. Community Governance Based on Sentiment Analysis: Towards Sustainable Management and Development. Sustainability. 2023; 15(3):2684. https://doi.org/10.3390/su15032684

Chicago/Turabian Style

Zhang, Xudong, Zejun Yan, Qianfeng Wu, Ke Wang, Kelei Miao, Zhangquan Wang, and Yourong Chen. 2023. "Community Governance Based on Sentiment Analysis: Towards Sustainable Management and Development" Sustainability 15, no. 3: 2684. https://doi.org/10.3390/su15032684

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