# The Big Data Analysis and Visualization of Mass Messages under “Smart Government Affairs” Based on Text Mining

Authors: Donghong Wang; Jiliang Guo
Journal: Mathematical Problems in Engineering
 (2022)

---

## Abstract

Based on the records of people’s political inquiries, comments from public sources on the Internet and the data of the relevant departments’ responses to some people’s messages, this study uses text analysis, text feature extraction, model building, text mining, and other evaluation methods to study and evaluate the three aspects of government services: analysis of public comments, mining of hot issues and evaluation of replies, which aims to prompt the government to understand the needs of the people quickly and solve the relevant problems in a timely and effective manner. The results show that the final classification accuracy using BERT is 3.4% and 1.8% higher than that using TF-IDF and Word2vec, respectively. Multi-classification of message data was realized by BERT combined with the LinearSVC algorithm, and the crowd message was accurately divided into seven types of problems, with an accuracy of 96.7%. It is intended to be transferred to relevant departments for processing. For problems related to people’s livelihood, law, economy, and other aspects, different departments should take countermeasures to solve them and achieve systematic, departmental, and regional coordination. This will enhance the ability of government platforms to deal with problems. Through the definition of hot indexes, hot issues mining can timely find the outstanding problems reflected by the masses. At the same time, the feedback evaluation system can comprehensively evaluate the work of relevant departments from the perspectives of relevance, completeness, and interpretability. Big data analysis technology based on text mining is a feasible way to solve the difficulties of text data analysis. The analysis model constructed in this study is suitable for mining and analyzing unstructured data with short text features, and the results can provide guidance for government decision-making.


---

## Body

## 1. Introduction

In the era of big data, the frequency of government information accumulation and exchange is gradually accelerating. Online political enquiry platforms such as “Mailbox of party secretary and Mayor”, 12345 government hotline, and public opinion message board have also increased the number of public opinion messages in the government system. How to improve the efficiency of government services based on public demand has become a new challenge for government departments and technology departments.“Smart politic inquiry” is a new democratic way for the people to actively participate in government decisions and protect their own interests. It is an important channel for the people to reflect on government services. It can also help the government departments quickly grasp the needs of the people in their life, work, security, and other aspects. However, with the advent of the information era, the amount of message text data obtained by the government system through network channels has increased significantly. In the first half of 2018, 137577 comments and 103573 replies were posted, according to People’s Daily Online. Compared with the second half of 2017, the number of comments and replies increased by 21.55% and 10.87%, respectively. The rate of increase has been greatly outpaced by manual sorting. Therefore, natural language processing technology surfaced to seek the hot issues that the public reflects and urges relevant departments to solve timely.The combination of natural language data processing and text data mining can effectively solve complex problems such as inaccurate classification of public office documents and inaccurate distribution of office documents, which can significantly improve the accuracy, processing effect, and residents’ satisfaction. It is an important sub-subject in the construction of a service-oriented government to solve small problems at the grassroots level through an intelligent government system. It is of great significance to improve the efficiency of government administration, enhance people’s happiness, promote social harmony, and improve relations between the people.


## 2. Literature Review

In the era of the “Internet plus”, the interaction mode between the government and the masses has also changed [1]. At present, the Chinese government integrates big data technology with government affairs in order to establish a smart government affairs platform, which aims to improve the enthusiasm of the masses to ask politics, and enhance the timeliness and transparency of government platform answers.In terms of the research model, the clustering analysis time can be reduced in the preprocessing of small classes of Chinese SMS texts [2], the TF-IDF, and Word2vec methods can comprehensively consider the discrimination ability and frequency of feature items [3], but has limited entity recognition ability [4], they can be replaced with BERT model in some ways [5], which improves the accuracy of reference values of GRUE and other items. For large categories of Chinese SMS texts, the clustering analysis opportunity should be improved as much as possible to increase the clustering effect of text information [6]. In the classification mode, random forest machine learning is implemented according to the word segmentation results of the article content, and the words with the most largest information in the article are extracted as the learning dimension to accurately classify the text [7]. After using the text data obtained by TF-IDF, text ordering can be calculated according to the decision tree of gradient lifting, thus proving the fact that the gradient lifting decision tree can correctly sort short texts [8]. The text clipping method and the improved model of feature weight calculation have better execution and adaptability in model evaluation [9].LDA is a language topic model, which is widely used in text mining, text topic analysis, and text similarity statistics in subordinate fields [10]. Text clustering technology based on the LDA topic model is used to cluster test data sets through the k-Means++ method selected in optimized clustering, which can improve the efficiency of searching data [11]. R software was used to establish the LDA topic model and extract the topic. LDAvis and other visual development tools were used to realize the interactive visual analysis of the problem model [12]. Meanwhile, TF-IDF and LDA’s Chinese FastText short text classification method were integrated. It also has high accuracy in the classification of Chinese short texts [13].At present, the feature engineering and classification model of short text have achieved a good verification effect [14–20]. The problem of sparsity in short text can be solved by modifying LJST and introducing BI-LJST [21]. The CLSTM model combined with CNN and LSTM greatly improves the efficiency of lexical classification and analysis [22]. However, the mass message in the government system is characterized by high complexity and wide distribution of the public text message, so the simple short text classification model cannot be well applied to such scenarios. Therefore, the BERT model in this study carries on the statement feature vector representation to get a better representation effect. For text classification, the best one is selected for classification and application through the evaluation and comprehensive comparison of the four classifiers. The text of messages is classified and predicted to be handed over to relevant departments for processing. For problems related to people’s livelihood, law, economy, and other categories, different departments should take targeted measures to solve them, and achieve systematic, departmental, and regional coordination. This will enhance the ability of government platforms to deal with problems. At the same time, considering the specific characteristics of the message text and the corresponding crowd, combined with Hanlp named entity recognition and LDA topic extraction, the hot issues hidden in a large number of message data are found accurately, and then the specific heat index is defined to sort the hot issues. By defining hot indexes to dig hot issues, we can timely find outstanding problems reflected by the masses and improve the emergency response ability of the government affairs platform. Finally, five evaluation indicators were defined and the evaluation results were obtained through k-means++ clustering and TOPSIS analysis. The evaluation system can comprehensively evaluate the work of relevant staff from the masses and the leadership; it can find out the loopholes in the work and the structural problems and language wording problems in the reply text, so as to facilitate the timely improvement of the relevant departments.


## 3. Analysis and Treatment of the Basic Characteristics of Messages from the Masses

Compared with manual division, the classification of message text by machine learning classification model can make the message division system clearer and accurate. The data in this study come from the public mail records of the Wuhan Municipal People’s Government Internet from 2019 to 2022 and the departments’ replies to part of the public voice mail. We use multithreading combined with Selenium to crawl the data in the Internet. At the same time, the data set provided by the Public Data open platform of Wuhan City can also be used. The classification model comparison and evaluation are used to select the best classifier for classification and application.


### 3.1. Extraction of Message Text Data

Message text is the data containing the masses that reflect information, the structure of a single piece of data as shown in Figure1, the amount of data of each label was explored according to the given “primary label”, and it was found that there was a certain degree of imbalance in the data categories, with “urban and rural construction”, “labor and social security”, and “educational style” taking up a large proportion, as shown in Figure 2.Figure 1
The structure of a single piece of text data.Figure 2
The proportion of each label in “primary label classification.”If unbalanced data are directly used for modeling prediction, the predicted results are more likely to be biased towards labels that account for a large proportion of the data set, which has a “subjective” impact on the classifier itself. Therefore, in order to alleviate the impact of category imbalance on the classifier, hierarchical data extraction is adopted to explore the minimum number of class “traffic”, and the same number of text is randomly extracted from other classes based on its text number of 613. Finally, unbalanced data are recombined to obtain balanced label data.


### 3.2. Categorical Text Preprocessing

Preprocessing plays an important role in short text classification and anomaly detection [23]. After alleviating the problem of category imbalance, the necessary texts are screened and cleaned. We remove special symbols and redundant blank and use regular expression matching to clean these characters to get data. In the mass message text, mostly some Chinese short text type data, compared with the long text, the short text is shorter, the text form is generally no more than 200 words, usually only a few to dozens of meaningful words. Therefore, “Message subject” and “message details” are combined as the classification basis to improve the richness and characteristics of the text. Finally, the precise mode of Jieba library is used to accurately separate the text and remove the stop words to get the processed message content, as shown in Figure 3.Figure 3
Message content after removing stop words (part).


### 3.3. Text Feature Engineering

BERT is a multi-task Model, which consists of a Masked Language Model and Next Sentence Prediction. Pretraining method of the Masked Language Model is used to randomly mask 15% words in a sentence, and then an unsupervised learning method is used to predict the words of mask position.In order to make the model capable of understanding long sequence context relations, the model adds a pretraining method for Next Sentence Prediction, that is, two sentences A and B are given, where the probability of B being the Next Sentence of A is 50%, and whether B is the Next Sentence of A is predicted through training model [4].The input part of BERT was a linear sequence. The two sentences were separated by delimiters, and two identification symbols were added at the front and back. The input vector was the sum of three vectors: Position Embeddings, Token Embeddings, and Segment Embeddings, as shown in Figure4.Figure 4
Input to BERT model.Position Embeddings represented the order of words by encoding Position information; the Token Embeddings divide words into a limited set of common subword units that express the validity of words while considering the flexibility of characters; the Segment Embeddings is used to distinguish two sentences and the global embedding term of the sentence corresponds to each word.In this study, the processed message content is put into the BERT model, and feature weight matrix variables are obtained after feature extraction. The specific process is shown in Figure5:Figure 5
BERT model application process.In the end, compared with other methods, the BERT model improves the final accuracy by 3.4% and 1.8%, respectively, as shown in Table1.Table 1
Final classification results using different models.
Classification accuracyTF-IDF0.933Word2vec0.949BERT0.967


### 3.4. Classification Model Analysis

In data mining, classification models can be divided into the supervised model and unsupervised model according to whether there is given training data. According to the conditions of the moderate scale of message text data in this study, multi-classification labels, and high robustness required by training results, the following four types of models are selected to classify the text data and the different characteristics of the models are compared, as shown in Table2.Table 2
Comparison of different models.
Classification modelLearning typeAdvantagesDisadvantagesMultinomialNBSupervisedGood performance on small-scale data, suitable for multi-classification tasks and incremental trainingSensitive to the presentation of input dataKNNUnsupervisedWith mature theory and simple algorithm, it is suitable to classify rare eventsIt is easy to mismark data with a small sample sizeLinearSVCSupervisedIt can be used for two-category classification or multi-category classification. Key samples can be grasped and a large number of redundant samples can be “eliminated” in training [24]Unable to support various kernels from low-dimensional to high-dimensional, only support linear kernelsRandom forestSupervisedSuitable for discrete and continuous attribute data, simple implementation, fast training speed, suitable for distributed computingSome noisy classification or regression problems are overfitted [25]Among them, the linear classification support vector machine is a linear SVM algorithm. SVM algorithm continuously seeks maximum interval hyperplane in data points. To find the partition hyperplane with “maximum interval”, that is, to maximize the sum of the distances between the two heterogeneous support vectors and the hyperplane, namely:(1)maxw,b2w,s.t.yiwTxi+b≥1,i=1,2,…,m.Obviously, in order to maximize the interval, only maximizingw−1∥w∥−1 is required, which is equivalent to minimizing w2. Then, the support vector machine model is obtained:(2)minw,b12w2,s.t.yiwTxi+b≥1,i=1,2,…,m.LinearSVC is based on a linear SVM algorithm, the penalty function is to punish the intercept, Liblinear optimizes the linear separable problem, so the convergence speed is faster than the libSVM on a large amount of data. When the number of training set instances is large (more than 10,000), it can be normalized well, supporting both dense input matrix and sparse input matrix. Meanwhile, the multi-classification problem is implemented by a one-vs-rest method.


### 3.5. Model Evaluation and Comparative Analysis

We segmented the data set according to the retention method, used the training set to generate the model, and then used the test set to test the accuracy and error of the model. After dividing the data set for many times, we found that when the test data accounted for 31% and the training data accounted for 69%, the model had a better verification effect. We select four classifiers to fit the training set. By comparing the prediction results with “first-level tags”, we get the prediction accuracy rate and consuming time of each classifier, as shown in Table3.Table 3
Comparison of accuracy of different models.
AccuracyTime (s)MultinomialNB0.9432.47KNN0.8631035.67LinearSVC0.9670.82Random forest0.9246.56In terms of the accuracy and time consumption obtained by the classifier, it can be seen that linear classification support vector machines are significantly better in both aspects, while the k-nearest neighbor model performs poorly, especially in time consumption. But this table alone does not adequately illustrate the effect of classification. The following is the evaluation of the model:Common model evaluation indexes include accuracy, recall rate, andF1 value. The confusion matrix of the four models is shown in Figures 6–9:Figure 6
Polynomial naive Bayes confusion matrix.Figure 7
K-nearest neighbor confusion matrix.Figure 8
Linear classification support vector machine confusion matrix.Figure 9
Random forest confusion matrix.Like the binary confusion matrix, the row of matrix data is the number of real value categories, and the column of matrix data is the number of categories after classification. By observing the prediction effect of each label within a single classifier, it can be seen that the prediction effect of “environmental protection” is more accurate, while the prediction effect of “business tourism” is poor. Through the comparison of multiple classifiers, it can be seen that the number of positive diagonal lines of the linear classification SVM confusion matrix is larger than that of other classifiers, indicating that the prediction is more accurate and the effect is better. Finally, thef1-Score obtained by different classifiers of each label was compared.It can be concluded from Table4 that linear classification support vector machines generally have higher F1 values in each tag compared with other models. At the same time, the classification results showed that “environmental protection” and “health and family planning” had a better prediction effect.Table 4
Accuracy table of different classifiers.
F1-scoreMultinomialNB0.87KNN0.81LinearSVC0.89Random forest0.80


### 3.6. Results Analysis

Through the data extraction, text preprocessing, text representation, model application, and model comparison evaluation of public comments. Ultimately, we select LinearSVC as a classification model and got 96% of the time; F1 values were 2.4%, 10.4%, and 4.3% higher than KNN, MultinomialNB, and random forest polynomial classifier, respectively. And the training time is shorter, which also verifies the applicability of BERT combined with the LinearSVC method in this kind of multi-classification problem of mass message text.


## 3.1. Extraction of Message Text Data

Message text is the data containing the masses that reflect information, the structure of a single piece of data as shown in Figure1, the amount of data of each label was explored according to the given “primary label”, and it was found that there was a certain degree of imbalance in the data categories, with “urban and rural construction”, “labor and social security”, and “educational style” taking up a large proportion, as shown in Figure 2.Figure 1
The structure of a single piece of text data.Figure 2
The proportion of each label in “primary label classification.”If unbalanced data are directly used for modeling prediction, the predicted results are more likely to be biased towards labels that account for a large proportion of the data set, which has a “subjective” impact on the classifier itself. Therefore, in order to alleviate the impact of category imbalance on the classifier, hierarchical data extraction is adopted to explore the minimum number of class “traffic”, and the same number of text is randomly extracted from other classes based on its text number of 613. Finally, unbalanced data are recombined to obtain balanced label data.


## 3.2. Categorical Text Preprocessing

Preprocessing plays an important role in short text classification and anomaly detection [23]. After alleviating the problem of category imbalance, the necessary texts are screened and cleaned. We remove special symbols and redundant blank and use regular expression matching to clean these characters to get data. In the mass message text, mostly some Chinese short text type data, compared with the long text, the short text is shorter, the text form is generally no more than 200 words, usually only a few to dozens of meaningful words. Therefore, “Message subject” and “message details” are combined as the classification basis to improve the richness and characteristics of the text. Finally, the precise mode of Jieba library is used to accurately separate the text and remove the stop words to get the processed message content, as shown in Figure 3.Figure 3
Message content after removing stop words (part).


## 3.3. Text Feature Engineering

BERT is a multi-task Model, which consists of a Masked Language Model and Next Sentence Prediction. Pretraining method of the Masked Language Model is used to randomly mask 15% words in a sentence, and then an unsupervised learning method is used to predict the words of mask position.In order to make the model capable of understanding long sequence context relations, the model adds a pretraining method for Next Sentence Prediction, that is, two sentences A and B are given, where the probability of B being the Next Sentence of A is 50%, and whether B is the Next Sentence of A is predicted through training model [4].The input part of BERT was a linear sequence. The two sentences were separated by delimiters, and two identification symbols were added at the front and back. The input vector was the sum of three vectors: Position Embeddings, Token Embeddings, and Segment Embeddings, as shown in Figure4.Figure 4
Input to BERT model.Position Embeddings represented the order of words by encoding Position information; the Token Embeddings divide words into a limited set of common subword units that express the validity of words while considering the flexibility of characters; the Segment Embeddings is used to distinguish two sentences and the global embedding term of the sentence corresponds to each word.In this study, the processed message content is put into the BERT model, and feature weight matrix variables are obtained after feature extraction. The specific process is shown in Figure5:Figure 5
BERT model application process.In the end, compared with other methods, the BERT model improves the final accuracy by 3.4% and 1.8%, respectively, as shown in Table1.Table 1
Final classification results using different models.
Classification accuracyTF-IDF0.933Word2vec0.949BERT0.967


## 3.4. Classification Model Analysis

In data mining, classification models can be divided into the supervised model and unsupervised model according to whether there is given training data. According to the conditions of the moderate scale of message text data in this study, multi-classification labels, and high robustness required by training results, the following four types of models are selected to classify the text data and the different characteristics of the models are compared, as shown in Table2.Table 2
Comparison of different models.
Classification modelLearning typeAdvantagesDisadvantagesMultinomialNBSupervisedGood performance on small-scale data, suitable for multi-classification tasks and incremental trainingSensitive to the presentation of input dataKNNUnsupervisedWith mature theory and simple algorithm, it is suitable to classify rare eventsIt is easy to mismark data with a small sample sizeLinearSVCSupervisedIt can be used for two-category classification or multi-category classification. Key samples can be grasped and a large number of redundant samples can be “eliminated” in training [24]Unable to support various kernels from low-dimensional to high-dimensional, only support linear kernelsRandom forestSupervisedSuitable for discrete and continuous attribute data, simple implementation, fast training speed, suitable for distributed computingSome noisy classification or regression problems are overfitted [25]Among them, the linear classification support vector machine is a linear SVM algorithm. SVM algorithm continuously seeks maximum interval hyperplane in data points. To find the partition hyperplane with “maximum interval”, that is, to maximize the sum of the distances between the two heterogeneous support vectors and the hyperplane, namely:(1)maxw,b2w,s.t.yiwTxi+b≥1,i=1,2,…,m.Obviously, in order to maximize the interval, only maximizingw−1∥w∥−1 is required, which is equivalent to minimizing w2. Then, the support vector machine model is obtained:(2)minw,b12w2,s.t.yiwTxi+b≥1,i=1,2,…,m.LinearSVC is based on a linear SVM algorithm, the penalty function is to punish the intercept, Liblinear optimizes the linear separable problem, so the convergence speed is faster than the libSVM on a large amount of data. When the number of training set instances is large (more than 10,000), it can be normalized well, supporting both dense input matrix and sparse input matrix. Meanwhile, the multi-classification problem is implemented by a one-vs-rest method.


## 3.5. Model Evaluation and Comparative Analysis

We segmented the data set according to the retention method, used the training set to generate the model, and then used the test set to test the accuracy and error of the model. After dividing the data set for many times, we found that when the test data accounted for 31% and the training data accounted for 69%, the model had a better verification effect. We select four classifiers to fit the training set. By comparing the prediction results with “first-level tags”, we get the prediction accuracy rate and consuming time of each classifier, as shown in Table3.Table 3
Comparison of accuracy of different models.
AccuracyTime (s)MultinomialNB0.9432.47KNN0.8631035.67LinearSVC0.9670.82Random forest0.9246.56In terms of the accuracy and time consumption obtained by the classifier, it can be seen that linear classification support vector machines are significantly better in both aspects, while the k-nearest neighbor model performs poorly, especially in time consumption. But this table alone does not adequately illustrate the effect of classification. The following is the evaluation of the model:Common model evaluation indexes include accuracy, recall rate, andF1 value. The confusion matrix of the four models is shown in Figures 6–9:Figure 6
Polynomial naive Bayes confusion matrix.Figure 7
K-nearest neighbor confusion matrix.Figure 8
Linear classification support vector machine confusion matrix.Figure 9
Random forest confusion matrix.Like the binary confusion matrix, the row of matrix data is the number of real value categories, and the column of matrix data is the number of categories after classification. By observing the prediction effect of each label within a single classifier, it can be seen that the prediction effect of “environmental protection” is more accurate, while the prediction effect of “business tourism” is poor. Through the comparison of multiple classifiers, it can be seen that the number of positive diagonal lines of the linear classification SVM confusion matrix is larger than that of other classifiers, indicating that the prediction is more accurate and the effect is better. Finally, thef1-Score obtained by different classifiers of each label was compared.It can be concluded from Table4 that linear classification support vector machines generally have higher F1 values in each tag compared with other models. At the same time, the classification results showed that “environmental protection” and “health and family planning” had a better prediction effect.Table 4
Accuracy table of different classifiers.
F1-scoreMultinomialNB0.87KNN0.81LinearSVC0.89Random forest0.80


## 3.6. Results Analysis

Through the data extraction, text preprocessing, text representation, model application, and model comparison evaluation of public comments. Ultimately, we select LinearSVC as a classification model and got 96% of the time; F1 values were 2.4%, 10.4%, and 4.3% higher than KNN, MultinomialNB, and random forest polynomial classifier, respectively. And the training time is shorter, which also verifies the applicability of BERT combined with the LinearSVC method in this kind of multi-classification problem of mass message text.


## 4. Hot Issues Mining

In order to let the relevant departments to improve the service efficiency, timely attention to the public response to the hot issues, and the masses can get effective services, the response of the problem can be solved in a timely manner, Gensim was used to calculate text similarity, the time window of threshold extraction was set after text classification, and the hot topic was extracted by LDA. Specific heat evaluation indicators are defined by the number of messages, the frequency of messages appearing in the time window, and the number of approval and disapproval.


### 4.1. The Specific Process

The flow chart of hotspot problem mining is shown in Figure10.Figure 10
Flow chart of hotspot problem mining.


### 4.2. Data Acquisition

The specific format of message text data from Internet open sources is shown in Figure11. Hot issues hidden in text data are mainly in the “Message topic” and “Message details” fields.Figure 11
Structure of text data.


### 4.3. Text Preprocessing

We merge fields of text data which named “Message topic” and “Message details” and preprocess the message text data. Removing special symbols and redundant blanks, using regular expression matching to clean these characters. Finally, we use the precise mode of the Jieba library to accurately separate the text and remove stop words, so as to get the processed message content, as shown in Figure12.Figure 12
Message content after removing stop words (part).


### 4.4. Gensim Text Represents and Computes Text Similarity

Gensim is a Python library for automatically extracting semantic topics from documents. It deals with native, unstructured, numeric text. Algorithms used in Gensim, such as latent semantic analysis LSA, implicit Dirichlet assignment or random prediction, discover the semantic structure of a document through the statistical symbiosis pattern of words in the same document in the training corpus.After using the obtained corpus to construct the dictionary, the corpus is obtained through the sparse vector Doc2Bow. Doc2Bow is a method encapsulated in Gensim, which is mainly used to implement the Bow model. This model ignores the grammar and word order of text and regards it as a collection of several words, each word in the document is independent. Bow uses an unordered set of words to express a piece of text or a document. Then, TF-IDF values of all messages are obtained through the TF-IDF model algorithm, as shown in Figure13.Figure 13
TF-IDF second-order matrix of all messages.The number of features obtained by token2ID (i.e. the number of keys in the dictionary) is 1251, and an index is established according to the similarity of a sparse matrix. Finally, word segmentation and text vectorization are performed on the test data, and the text similarity of each text in the test data and training data is calculated successively.


### 4.5. Text Classification

After obtaining the similarity of the text, it is necessary to classify the highly relevant text to obtain the training text set related to the test text. In this study, the threshold is set to judge multiple texts as one text, so as to achieve the classification of messages reflecting similar problems, and the threshold with the best effect is found through adjustment. The effect is shown in Figure14.Figure 14
Classification effect diagram of test data (part).


### 4.6. Definition of Heat Index

In daily life, hot issues refer to issues that occur frequently at a certain time or place. They have the characteristics of attracting wide public attention, participating in the discussion, arousing public emotions, and triggering strong responses. To obtain the top hotspot issues, you need to define specific hotspot indicators and then prioritize hotspot issues.In this process, if the definition is only defined from the number of occurrences of each problem within the time interval, there are problems that cannot control a single variable. Therefore, the frequency of different problems in different time periods is introduced to define the hot spot index. The number of “Like” and “Dislike” corresponding to each message is an important basis for other people’s approval or disapproval, which reflects the authenticity and importance of a message to a certain extent. It can provide an important basis for relevant departments to deal with the priority of the problem. Based on the above aspects, a certain weight is assigned to each indicator:For example, the variable heat_num, given a weight of 0.3, stores the number of problems of each type; time_lag, the amount of time (in days) that each type of problem is stored; Freq, with a weight of 0.5, stores the frequency of each type of problem; Like and Dislike are given weights of 0.1 and (−0.1) respectively to store the total number of approval and disapproval for each type of question. Heat_value, stores the heat index of each type of problem, then:(3)Freqi=heat_numitime_lagi,Heat_valuei=heat_numi×0.3+Freqi×0.5+Likei×0.1−Dislikei×−0.1.We sort the hot issues according to the hot issues index and reserve two decimal places. The top five hot issues and heat index are shown in Table5.Table 5
Top five hot issues and heat index table.
Hot issueHeat_numFreqLikeDislikeHeat_value1460.12164130.162660.2736323.243180.05172222.434490.2352219.825320.1166315.96


### 4.7. Extraction of Time Window

Save the time window and time interval in days for the first five hot issues, as shown in Table6.Table 6
Time window table.
Number of questionTime_Lag12019-01-03–2020-01-0622019-03-18–2019-11-2032019-01-02–2020-01-0742019-06-25–2020-01-2652019-01-02–2019-11-01


### 4.8. LDA Extracts Topics

LDA is a probabilistic generation model for mining text potential topics. It is based on the common-sense assumption that the implied topic set is composed of a series of related features, and all documents in the document set share the implied topic set in a certain proportion. We put classified hot spot problem sets into the LDA model for fitting, and output the top 20 topic words with the highest weight, as shown in Figure15.Figure 15
Hot topic words.At the same time, LDAvis was used to view the first 30 relevant terms in each topic, and the correlation of a certain word topic was adjusted byλ parameter to determine whether the first 30 relevant terms appeared the most frequently or the most unique topic.Ifλ is close to 1, words that appear frequently in the text are more relevant to the topic.Ifλ is close to 0, words that appear specific or unique in the text are more relevant to that topic.Adjustλ to 0.8 and focus on high-frequency words such as “community, owner, developer, leader”. The red bar indicates the frequency of occurrence of the word in the selected topic, and the light blue bar indicates the frequency of occurrence of the word in the corpus. It can be seen that the main keywords representing the theme include “community, owner, department, property”, as shown in Figure 16.Figure 16
LDAvis theme visualization.Click on the right panel of the term, the left panel on behalf of the theme of bubbles will also change, each bubble location remains the same, but the area is become by the term scale distribution on these topics; Figure17 shows visualization of results after click “run” term; it can be seen that the term is mainly appeared in the topic 4, also have a little in theme 1.Figure 17
LDAvis topic visualization after clicking on the “business” term.


### 4.9. Hanlp Named Entity Recognition

For each type of problem-specific place or crowd, we select the natural language processing toolkit named Hanlp. It takes word sequence as observation sequence and role sequence as a hidden sequence. When the model predicts the best hidden state sequence, it uses the mode maximum matching method to match the entity. In the process, sentence structure and semantic analysis depend on part-of-speech tagging, and part-of-speech tagging depends on word segmentation, so we build pipelines for the set of each kind of problem to flexibly combine various components (statistical model or rule system), as shown in Figure18.Figure 18
Flow chart of named entity recognition.After creating the pipeline, we store the pipeline serialization file. For each type of identified sites, it can be found that there are some sites not specific, such as “Bin He Garden, Yi Jing Garden, Wu Guang New Town, Guangzhou Railway Group of A City”, the identified sites may be incomplete, as shown in Figure19. Therefore, places and groups with the most frequent occurrence are extracted and summarized, and then combined with other parts of words to form a complete place or group (“nr”: The person’s name “ns”: Place names “nt”: Organization).Figure 19
Named entity recognition site (before merger).


### 4.10. Merge the Hot Issues List and Message List

After obtaining the heat index, time range, location, or group of top five hot issues and the topic description extracted by LDA, they are sorted in descending order according to the hot index to obtain the hot issues table, as shown in Table7. Add the message details of each type of problem to the message list.Table 7
Hot issues table.
Hot rankHeat indexTime rangePlace/groupProblem description130.1602019 01 03–2020 01 06Subway line inA citySubway construction inA city is A nuisance to residents223.2352019 03 18–2019 11 20Yijing garden, Wuguang new city, Guangzhou railway group, A cityForced bundled sales of parking spaces to owners322.4252019 01 02–2020 01 07A7 Quanxing parkIdle land park construction419.8152019 06 25–2020 01 26A city Rongyun street Lifa new city community mixing stationThe mixing station near the community is disturbing people515.9552019 01 22–2019 11 01CityAAccelerate construction effortsIt can be seen that the highest heat index is “the disturbance caused by subway construction inA City”. Although the number and frequency of this issue are not as high as that of hot issue 2, the number of “Like” is especially high, and the number of “Dislike” is relatively small. It reflects the large “flow” of this kind of question, which has raised significant attention and needs to be solved urgently. Similarly, compared with hot issue 4 and hot issue 5, although the frequency of hot issue 3 is lower, the number of “Like” is relatively high.As shown in Table8, hot issues 1 and 3, which appear scattered in a different time but the number of “Like” is high, mainly reflect the long-term concern of the masses. They have always been very concerned by the masses but have not been solved in time. They can be called “continuous attention type”. For the hot issues 2, 4, and 5 that appeared in a concentrated time and had a large number of comments. This kind of problem can be called an “emergent hot spot” problem and need to be solved by the relevant authorities. Generally speaking, the relevant authorities can decide how urgent to deal with the problem according to the heat index.Table 8
Top five hot issues and heat index table.
Hot issueHeat_numFreqLikeDislikeHeat_value1460.12164130.162660.2736323.243180.05172222.434490.2352219.825320.1166315.96


## 4.1. The Specific Process

The flow chart of hotspot problem mining is shown in Figure10.Figure 10
Flow chart of hotspot problem mining.


## 4.2. Data Acquisition

The specific format of message text data from Internet open sources is shown in Figure11. Hot issues hidden in text data are mainly in the “Message topic” and “Message details” fields.Figure 11
Structure of text data.


## 4.3. Text Preprocessing

We merge fields of text data which named “Message topic” and “Message details” and preprocess the message text data. Removing special symbols and redundant blanks, using regular expression matching to clean these characters. Finally, we use the precise mode of the Jieba library to accurately separate the text and remove stop words, so as to get the processed message content, as shown in Figure12.Figure 12
Message content after removing stop words (part).


## 4.4. Gensim Text Represents and Computes Text Similarity

Gensim is a Python library for automatically extracting semantic topics from documents. It deals with native, unstructured, numeric text. Algorithms used in Gensim, such as latent semantic analysis LSA, implicit Dirichlet assignment or random prediction, discover the semantic structure of a document through the statistical symbiosis pattern of words in the same document in the training corpus.After using the obtained corpus to construct the dictionary, the corpus is obtained through the sparse vector Doc2Bow. Doc2Bow is a method encapsulated in Gensim, which is mainly used to implement the Bow model. This model ignores the grammar and word order of text and regards it as a collection of several words, each word in the document is independent. Bow uses an unordered set of words to express a piece of text or a document. Then, TF-IDF values of all messages are obtained through the TF-IDF model algorithm, as shown in Figure13.Figure 13
TF-IDF second-order matrix of all messages.The number of features obtained by token2ID (i.e. the number of keys in the dictionary) is 1251, and an index is established according to the similarity of a sparse matrix. Finally, word segmentation and text vectorization are performed on the test data, and the text similarity of each text in the test data and training data is calculated successively.


## 4.5. Text Classification

After obtaining the similarity of the text, it is necessary to classify the highly relevant text to obtain the training text set related to the test text. In this study, the threshold is set to judge multiple texts as one text, so as to achieve the classification of messages reflecting similar problems, and the threshold with the best effect is found through adjustment. The effect is shown in Figure14.Figure 14
Classification effect diagram of test data (part).


## 4.6. Definition of Heat Index

In daily life, hot issues refer to issues that occur frequently at a certain time or place. They have the characteristics of attracting wide public attention, participating in the discussion, arousing public emotions, and triggering strong responses. To obtain the top hotspot issues, you need to define specific hotspot indicators and then prioritize hotspot issues.In this process, if the definition is only defined from the number of occurrences of each problem within the time interval, there are problems that cannot control a single variable. Therefore, the frequency of different problems in different time periods is introduced to define the hot spot index. The number of “Like” and “Dislike” corresponding to each message is an important basis for other people’s approval or disapproval, which reflects the authenticity and importance of a message to a certain extent. It can provide an important basis for relevant departments to deal with the priority of the problem. Based on the above aspects, a certain weight is assigned to each indicator:For example, the variable heat_num, given a weight of 0.3, stores the number of problems of each type; time_lag, the amount of time (in days) that each type of problem is stored; Freq, with a weight of 0.5, stores the frequency of each type of problem; Like and Dislike are given weights of 0.1 and (−0.1) respectively to store the total number of approval and disapproval for each type of question. Heat_value, stores the heat index of each type of problem, then:(3)Freqi=heat_numitime_lagi,Heat_valuei=heat_numi×0.3+Freqi×0.5+Likei×0.1−Dislikei×−0.1.We sort the hot issues according to the hot issues index and reserve two decimal places. The top five hot issues and heat index are shown in Table5.Table 5
Top five hot issues and heat index table.
Hot issueHeat_numFreqLikeDislikeHeat_value1460.12164130.162660.2736323.243180.05172222.434490.2352219.825320.1166315.96


## 4.7. Extraction of Time Window

Save the time window and time interval in days for the first five hot issues, as shown in Table6.Table 6
Time window table.
Number of questionTime_Lag12019-01-03–2020-01-0622019-03-18–2019-11-2032019-01-02–2020-01-0742019-06-25–2020-01-2652019-01-02–2019-11-01


## 4.8. LDA Extracts Topics

LDA is a probabilistic generation model for mining text potential topics. It is based on the common-sense assumption that the implied topic set is composed of a series of related features, and all documents in the document set share the implied topic set in a certain proportion. We put classified hot spot problem sets into the LDA model for fitting, and output the top 20 topic words with the highest weight, as shown in Figure15.Figure 15
Hot topic words.At the same time, LDAvis was used to view the first 30 relevant terms in each topic, and the correlation of a certain word topic was adjusted byλ parameter to determine whether the first 30 relevant terms appeared the most frequently or the most unique topic.Ifλ is close to 1, words that appear frequently in the text are more relevant to the topic.Ifλ is close to 0, words that appear specific or unique in the text are more relevant to that topic.Adjustλ to 0.8 and focus on high-frequency words such as “community, owner, developer, leader”. The red bar indicates the frequency of occurrence of the word in the selected topic, and the light blue bar indicates the frequency of occurrence of the word in the corpus. It can be seen that the main keywords representing the theme include “community, owner, department, property”, as shown in Figure 16.Figure 16
LDAvis theme visualization.Click on the right panel of the term, the left panel on behalf of the theme of bubbles will also change, each bubble location remains the same, but the area is become by the term scale distribution on these topics; Figure17 shows visualization of results after click “run” term; it can be seen that the term is mainly appeared in the topic 4, also have a little in theme 1.Figure 17
LDAvis topic visualization after clicking on the “business” term.


## 4.9. Hanlp Named Entity Recognition

For each type of problem-specific place or crowd, we select the natural language processing toolkit named Hanlp. It takes word sequence as observation sequence and role sequence as a hidden sequence. When the model predicts the best hidden state sequence, it uses the mode maximum matching method to match the entity. In the process, sentence structure and semantic analysis depend on part-of-speech tagging, and part-of-speech tagging depends on word segmentation, so we build pipelines for the set of each kind of problem to flexibly combine various components (statistical model or rule system), as shown in Figure18.Figure 18
Flow chart of named entity recognition.After creating the pipeline, we store the pipeline serialization file. For each type of identified sites, it can be found that there are some sites not specific, such as “Bin He Garden, Yi Jing Garden, Wu Guang New Town, Guangzhou Railway Group of A City”, the identified sites may be incomplete, as shown in Figure19. Therefore, places and groups with the most frequent occurrence are extracted and summarized, and then combined with other parts of words to form a complete place or group (“nr”: The person’s name “ns”: Place names “nt”: Organization).Figure 19
Named entity recognition site (before merger).


## 4.10. Merge the Hot Issues List and Message List

After obtaining the heat index, time range, location, or group of top five hot issues and the topic description extracted by LDA, they are sorted in descending order according to the hot index to obtain the hot issues table, as shown in Table7. Add the message details of each type of problem to the message list.Table 7
Hot issues table.
Hot rankHeat indexTime rangePlace/groupProblem description130.1602019 01 03–2020 01 06Subway line inA citySubway construction inA city is A nuisance to residents223.2352019 03 18–2019 11 20Yijing garden, Wuguang new city, Guangzhou railway group, A cityForced bundled sales of parking spaces to owners322.4252019 01 02–2020 01 07A7 Quanxing parkIdle land park construction419.8152019 06 25–2020 01 26A city Rongyun street Lifa new city community mixing stationThe mixing station near the community is disturbing people515.9552019 01 22–2019 11 01CityAAccelerate construction effortsIt can be seen that the highest heat index is “the disturbance caused by subway construction inA City”. Although the number and frequency of this issue are not as high as that of hot issue 2, the number of “Like” is especially high, and the number of “Dislike” is relatively small. It reflects the large “flow” of this kind of question, which has raised significant attention and needs to be solved urgently. Similarly, compared with hot issue 4 and hot issue 5, although the frequency of hot issue 3 is lower, the number of “Like” is relatively high.As shown in Table8, hot issues 1 and 3, which appear scattered in a different time but the number of “Like” is high, mainly reflect the long-term concern of the masses. They have always been very concerned by the masses but have not been solved in time. They can be called “continuous attention type”. For the hot issues 2, 4, and 5 that appeared in a concentrated time and had a large number of comments. This kind of problem can be called an “emergent hot spot” problem and need to be solved by the relevant authorities. Generally speaking, the relevant authorities can decide how urgent to deal with the problem according to the heat index.Table 8
Top five hot issues and heat index table.
Hot issueHeat_numFreqLikeDislikeHeat_value1460.12164130.162660.2736323.243180.05172222.434490.2352219.825320.1166315.96


## 5. Reply Comment Evaluation

For the problem that the masses reflect, the quality of the reply given by the relevant departments is worth evaluating; the relevance, integrity, timeliness, courtesy, and so on of the reply content are very important evaluation indicators. Government service is a kind of invisible labor, service can directly meet the needs of the service object, and there is no intermediate conversion link. Therefore, every service work and every service process must meet the requirements of service quality in order to realize the satisfaction of the masses.Cluster analysis of evaluation indicators for established responses. Thek-means++ method was used to cluster the different responses and analyze their characteristics. The classification model is used to predict the new response text with the clustering result as the label.


### 5.1. Evaluation Indicators of Reply Opinion

#### 5.1.1. Reply Words

Preprocessing each reply, counting the words of valid reply, and storing them. The number of words in the reply text can reflect the completeness of the reply to a certain extent.


#### 5.1.2. Reply Time Interval

Reply time interval is an important indicator to reflect the timeliness of government reply. If it is a hot event or topic, timely processing and reply is a timely reference and an important solution to the problems of the masses. If the response time is too long, the masses wait for a long time, it is easy to cause a wider range of impact. In this study, the time interval between responses to each message is calculated in days.


#### 5.1.3. Degree of Politeness

Observing the text comment data, the detailed polite reply text format is shown in Figure20. After word segmentation, we import a polite words file, traverse each reply opinion text, and count the number of polite words in each text.Figure 20
Polite text format.


#### 5.1.4. Reply Level

In this study, the label of response grade was created, and each comment text was manually marked. The labels were divided into 1, 2, and 3, corresponding to three grades of good, medium, and poor respectively. The specific definition method is as follows:Good: the reply text gives a detailed explanation to the problem of the masses’ response, and after the explanation, gives a detailed explanation plan according to the complete and specific legal provisions or corresponding policies. The government will promise to deal with the problem in a timely manner or has dealt with it, and explains the reasons for solving and improving methods.Medium: the answer text gives a detailed explanation of the problem of mass response and gives the explanation scheme and reasons according to the legal provisions or corresponding policies after the explanation. But no specific solutions or promised responses were given.Poor: the reply text does not explain the problem of mass response, does not put forward effective solutions, only replies “received”, “transferred to relevant departments to deal with” or the reply text is extremely incomplete.The text data after an annotation is shown in Figure21:Figure 21
Text data after annotation (part).


#### 5.1.5. Text Similarity

Text similarity of reply and question is an important indicator to measure the relevance of reply content. In this chapter, the cosine similarity algorithm is selected to calculate text similarity.Cosine similarity algorithm: the text similarity of response and question can be calculated as two line segments in space, both pointing in different directions from the origin vector 0. If the included Angle of a line segment is 0°, it means that the text represented by two vectors is completely equal. If the Angle is 90°, it is completely dissimilar. Therefore, the similarity of vectors can be judged by the size of the included Angle. The smaller the Angle, the more similar it is.The calculation formula is:(4)cosθ=∑i=1nxi×yi∑i=1nxi2×∑i=1nyi2.Specific process:Word segmentation -> list all words -> word segmentation coding -> word frequency vectorization -> Cosine function is applied to measure the similarity of two sentences.A zero-filled matrix of a given shape and type stores a vector, nested into a statistical word frequency function and printed. Finally, the cosine function is used to measure the similarity of two sentences. The Score variable is introduced to store the similarity between each message text and the reply text. Taking the first reply text as an example, the text vector of the question and reply is shown in Figure22.Figure 22
Question and reply text vector.


### 5.2. Index Aggregate

Five well-defined indicators are aggregated to obtain indicator data, as shown in Table9. The standardized data are shown in Table 10.Table 9
Top five hot issues and heat index table.
Hot issueHeat_numFreqLikeDislikeHeat_value1460.12164130.162660.2736323.243180.05172222.434490.2352219.825320.1166315.96Table 10
Standardized index data.
01234Count2816.0000002816.0000002816.0000002816.0000002816.000000Mean0.0450470.1563790.6024500.1734850.438229Std0.0547310.1668850.3601820.1051020.177259Min0.0000000.0000000.0000000.0000000.00000025%0.0177200.0404040.5000000.1000000.31959850%0.0341650.1111110.5000000.1666670.44740675%0.0554300.2121211.0000000.2333330.563690Max1.0000001.0000001.0000001.0000001.000000


### 5.3.K-means++ Reply Text Clustering

For a given sample set, k-means algorithm divides the sample set into K clusters according to the distance between samples. Make the points in the cluster as close together as possible and make the distance between the clusters as large as possible. The original data were normalized to the interval [0,1], and the transformed data were dimensionally reduced by PCA and then substituted into k-means++ for fitting. Finally, different cluster numbers are selected to check the clustering effect obtained by different cluster numbers. When the cluster number is 4, the clustering effect is the best. The maximum contour coefficient is 0.7, as shown in Figure23.Figure 23
Standardized index data.After clustering, the numbers of four kinds of aggregates were 1174, 1000, 500, and 142, respectively. The message numbers of the four types of reply texts are saved.


### 5.4. Analysis of Clustering Results

The clustering center point of each clustering data is drawn in radar map. The characteristics of different types of reply texts are analyzed by comparing the number of words, response time, politeness, reply level, and similarity. The clustering radar diagram is shown in Figure24.Figure 24
Feature distribution of the four types of reply texts.The message text can be classified into four types as follows:(1)
Delayed response with high quality: the response number of words, polite terms, similarity, and response level are better, but the response time is poor.It can be found that although such text reply has good integrity, interpretability, and relevance to questions, it still has the problem of too long reply time. For some emergent hot issues, it may not get a timely reply and miss the best solution time.(2)
Low-quality response: the response number of words, polite terms, similarity, and response level are poor, and the response time is better.Although this kind of text reply takes a short time, the reply is incomplete (the specific solution link is not given); the similarity of the reply is not high (reply time only). The content of the reply is not targeted, no specific reasons are given, and no effective solutions are brought to the masses.(3)
Timely and high-quality reply: the number of words, polite words, similarity, reply grade and reply duration are all better.This type of text reply has a good performance in all five indicators. The text conforms to a complete canonical format and the replies are highly relevant to the questions asked. Politely explain the problems raised by the masses, put forward the reasons for the problems, and provide effective solutions in a timely manner.(4)
Timely quality response: politeness, similarity, response level and response time are better, but the response number is poor.This kind of text is the most timely reply in terms of time, but in terms of content, such a reply only puts forward some suggestions and legal and policy provisions. There was no effective solution or commitment to the problem of mass response. Although such texts have a certain reference value, some substantive solutions are still needed to address the problems reported by the masses.


## 5.1. Evaluation Indicators of Reply Opinion

### 5.1.1. Reply Words

Preprocessing each reply, counting the words of valid reply, and storing them. The number of words in the reply text can reflect the completeness of the reply to a certain extent.


### 5.1.2. Reply Time Interval

Reply time interval is an important indicator to reflect the timeliness of government reply. If it is a hot event or topic, timely processing and reply is a timely reference and an important solution to the problems of the masses. If the response time is too long, the masses wait for a long time, it is easy to cause a wider range of impact. In this study, the time interval between responses to each message is calculated in days.


### 5.1.3. Degree of Politeness

Observing the text comment data, the detailed polite reply text format is shown in Figure20. After word segmentation, we import a polite words file, traverse each reply opinion text, and count the number of polite words in each text.Figure 20
Polite text format.


### 5.1.4. Reply Level

In this study, the label of response grade was created, and each comment text was manually marked. The labels were divided into 1, 2, and 3, corresponding to three grades of good, medium, and poor respectively. The specific definition method is as follows:Good: the reply text gives a detailed explanation to the problem of the masses’ response, and after the explanation, gives a detailed explanation plan according to the complete and specific legal provisions or corresponding policies. The government will promise to deal with the problem in a timely manner or has dealt with it, and explains the reasons for solving and improving methods.Medium: the answer text gives a detailed explanation of the problem of mass response and gives the explanation scheme and reasons according to the legal provisions or corresponding policies after the explanation. But no specific solutions or promised responses were given.Poor: the reply text does not explain the problem of mass response, does not put forward effective solutions, only replies “received”, “transferred to relevant departments to deal with” or the reply text is extremely incomplete.The text data after an annotation is shown in Figure21:Figure 21
Text data after annotation (part).


### 5.1.5. Text Similarity

Text similarity of reply and question is an important indicator to measure the relevance of reply content. In this chapter, the cosine similarity algorithm is selected to calculate text similarity.Cosine similarity algorithm: the text similarity of response and question can be calculated as two line segments in space, both pointing in different directions from the origin vector 0. If the included Angle of a line segment is 0°, it means that the text represented by two vectors is completely equal. If the Angle is 90°, it is completely dissimilar. Therefore, the similarity of vectors can be judged by the size of the included Angle. The smaller the Angle, the more similar it is.The calculation formula is:(4)cosθ=∑i=1nxi×yi∑i=1nxi2×∑i=1nyi2.Specific process:Word segmentation -> list all words -> word segmentation coding -> word frequency vectorization -> Cosine function is applied to measure the similarity of two sentences.A zero-filled matrix of a given shape and type stores a vector, nested into a statistical word frequency function and printed. Finally, the cosine function is used to measure the similarity of two sentences. The Score variable is introduced to store the similarity between each message text and the reply text. Taking the first reply text as an example, the text vector of the question and reply is shown in Figure22.Figure 22
Question and reply text vector.


## 5.1.1. Reply Words

Preprocessing each reply, counting the words of valid reply, and storing them. The number of words in the reply text can reflect the completeness of the reply to a certain extent.


## 5.1.2. Reply Time Interval

Reply time interval is an important indicator to reflect the timeliness of government reply. If it is a hot event or topic, timely processing and reply is a timely reference and an important solution to the problems of the masses. If the response time is too long, the masses wait for a long time, it is easy to cause a wider range of impact. In this study, the time interval between responses to each message is calculated in days.


## 5.1.3. Degree of Politeness

Observing the text comment data, the detailed polite reply text format is shown in Figure20. After word segmentation, we import a polite words file, traverse each reply opinion text, and count the number of polite words in each text.Figure 20
Polite text format.


## 5.1.4. Reply Level

In this study, the label of response grade was created, and each comment text was manually marked. The labels were divided into 1, 2, and 3, corresponding to three grades of good, medium, and poor respectively. The specific definition method is as follows:Good: the reply text gives a detailed explanation to the problem of the masses’ response, and after the explanation, gives a detailed explanation plan according to the complete and specific legal provisions or corresponding policies. The government will promise to deal with the problem in a timely manner or has dealt with it, and explains the reasons for solving and improving methods.Medium: the answer text gives a detailed explanation of the problem of mass response and gives the explanation scheme and reasons according to the legal provisions or corresponding policies after the explanation. But no specific solutions or promised responses were given.Poor: the reply text does not explain the problem of mass response, does not put forward effective solutions, only replies “received”, “transferred to relevant departments to deal with” or the reply text is extremely incomplete.The text data after an annotation is shown in Figure21:Figure 21
Text data after annotation (part).


## 5.1.5. Text Similarity

Text similarity of reply and question is an important indicator to measure the relevance of reply content. In this chapter, the cosine similarity algorithm is selected to calculate text similarity.Cosine similarity algorithm: the text similarity of response and question can be calculated as two line segments in space, both pointing in different directions from the origin vector 0. If the included Angle of a line segment is 0°, it means that the text represented by two vectors is completely equal. If the Angle is 90°, it is completely dissimilar. Therefore, the similarity of vectors can be judged by the size of the included Angle. The smaller the Angle, the more similar it is.The calculation formula is:(4)cosθ=∑i=1nxi×yi∑i=1nxi2×∑i=1nyi2.Specific process:Word segmentation -> list all words -> word segmentation coding -> word frequency vectorization -> Cosine function is applied to measure the similarity of two sentences.A zero-filled matrix of a given shape and type stores a vector, nested into a statistical word frequency function and printed. Finally, the cosine function is used to measure the similarity of two sentences. The Score variable is introduced to store the similarity between each message text and the reply text. Taking the first reply text as an example, the text vector of the question and reply is shown in Figure22.Figure 22
Question and reply text vector.


## 5.2. Index Aggregate

Five well-defined indicators are aggregated to obtain indicator data, as shown in Table9. The standardized data are shown in Table 10.Table 9
Top five hot issues and heat index table.
Hot issueHeat_numFreqLikeDislikeHeat_value1460.12164130.162660.2736323.243180.05172222.434490.2352219.825320.1166315.96Table 10
Standardized index data.
01234Count2816.0000002816.0000002816.0000002816.0000002816.000000Mean0.0450470.1563790.6024500.1734850.438229Std0.0547310.1668850.3601820.1051020.177259Min0.0000000.0000000.0000000.0000000.00000025%0.0177200.0404040.5000000.1000000.31959850%0.0341650.1111110.5000000.1666670.44740675%0.0554300.2121211.0000000.2333330.563690Max1.0000001.0000001.0000001.0000001.000000


## 5.3.K-means++ Reply Text Clustering

For a given sample set, k-means algorithm divides the sample set into K clusters according to the distance between samples. Make the points in the cluster as close together as possible and make the distance between the clusters as large as possible. The original data were normalized to the interval [0,1], and the transformed data were dimensionally reduced by PCA and then substituted into k-means++ for fitting. Finally, different cluster numbers are selected to check the clustering effect obtained by different cluster numbers. When the cluster number is 4, the clustering effect is the best. The maximum contour coefficient is 0.7, as shown in Figure23.Figure 23
Standardized index data.After clustering, the numbers of four kinds of aggregates were 1174, 1000, 500, and 142, respectively. The message numbers of the four types of reply texts are saved.


## 5.4. Analysis of Clustering Results

The clustering center point of each clustering data is drawn in radar map. The characteristics of different types of reply texts are analyzed by comparing the number of words, response time, politeness, reply level, and similarity. The clustering radar diagram is shown in Figure24.Figure 24
Feature distribution of the four types of reply texts.The message text can be classified into four types as follows:(1)
Delayed response with high quality: the response number of words, polite terms, similarity, and response level are better, but the response time is poor.It can be found that although such text reply has good integrity, interpretability, and relevance to questions, it still has the problem of too long reply time. For some emergent hot issues, it may not get a timely reply and miss the best solution time.(2)
Low-quality response: the response number of words, polite terms, similarity, and response level are poor, and the response time is better.Although this kind of text reply takes a short time, the reply is incomplete (the specific solution link is not given); the similarity of the reply is not high (reply time only). The content of the reply is not targeted, no specific reasons are given, and no effective solutions are brought to the masses.(3)
Timely and high-quality reply: the number of words, polite words, similarity, reply grade and reply duration are all better.This type of text reply has a good performance in all five indicators. The text conforms to a complete canonical format and the replies are highly relevant to the questions asked. Politely explain the problems raised by the masses, put forward the reasons for the problems, and provide effective solutions in a timely manner.(4)
Timely quality response: politeness, similarity, response level and response time are better, but the response number is poor.This kind of text is the most timely reply in terms of time, but in terms of content, such a reply only puts forward some suggestions and legal and policy provisions. There was no effective solution or commitment to the problem of mass response. Although such texts have a certain reference value, some substantive solutions are still needed to address the problems reported by the masses.


## 6. Conclusion

The “smart government text” includes the messages from the masses, the hot issues that the masses care about, and the solution data of relevant work departments. The internal information is mined and analyzed, and it is concluded that the model proposed in this study has good performance. The distinct contribution of this study is threefold.Firstly, we use BERT combined with the LinearSVC algorithm to realize multi-classification of message data. The result of the final classification accuracy using BERT is 96.7%, which is 3.4% and 1.8% higher than that using TF-IDF and Word2vec, respectively. It is helpful for the government to categorize services by accurately classifying messages from the masses into seven categories: urban and rural construction, environmental protection, transportation, education, culture and sports, labor and social security, trade and tourism, and health and family planning.Secondly, in order to dig hot issues of the masses, this study sets the time window, and used Hanlp named entity recognition, fuzzy matching and high-frequency words to extract place names and people in each category. In the corresponding time window and corresponding location, hot issues are accurately matched and extracted. The heat value was calculated by various indexes and LDAvis was used to visualize the problems with high heat values. The results show that construction, property management, urban infrastructure, and other aspects have a great impact on people’s life and work, and it is suggested that the relevant units should give priority to solve the problem.Thirdly, when evaluating the replies from the masses, this study constructs the quality evaluation index system of replies from five aspects, including reply words, reply time, the number of polite expressions, reply grade, and similarity, which is characterized by each index value. The data were aggregated into four categories: delayed high-quality reply, low-quality reply, timely high-quality reply, and timely medium-quality reply to evaluate the replies.Public feedback plays an important reference role in the construction of government affairs and the improvement of government affairs capacity. To improve the existing problems in government services, the feedback side of the public and the solution side of the government affairs center should be carried out simultaneously. This paper focuses on the study of the “smart government” in the mass message solution-side of the three links, the mass message analysis and hot issues mining can quickly find the key problems of mass text data and transfer to the relevant departments for processing in time. Reply opinion evaluation can carry on the comprehensive evaluation to the relevant staff’s work from the masses and the leadership, so as to find out the loopholes in the work, and the relevant departments can improve in time.In future research, there are still many links in the solution-side of the government affairs center. Quick solution ability is the government platform should possess. Only then can we meet the needs of the masses. At the same time, the application of new technology in government affairs can assist leaders to make accurate and correct decisions and accelerate the speed of the whole system. Big data analysis technology based on text mining is a feasible way to solve the difficulty of text data analysis. The analysis model constructed in this study is suitable for the mining and analysis of unstructured data with short text characteristics, and the results can provide guidance for government decision-making.



---

*Source: 8594233-2022-09-19.xml*