Introduction

In recent years, the ascendancy of the sustainable development paradigm has been conspicuous on a global scale. Foremost among its tenets is the imperative to meet present exigencies while safeguarding the capacity of forthcoming generations to meet their own, thereby eschewing compromise. This paradigm harmonizes the environmental, social, and economic dimensions, championing enduring resource utilization and development resilience to confront pressing global predicaments, including climate change, resource depletion, and social disparity (Jeronen, 2020) As a cardinal guiding principle, sustainable development assumes a central role in steering social advancement, furnishing a shared vision and framework for realizing the global Sustainable Development Goals (SDGs). Additionally, the pursuit of sustainable development transcends mere moral obligation; it stands as a strategic imperative in the face of escalating environmental and social exigencies. The specters of climate change, resource scarcity, and ecosystem collapse loom ever larger, and sustainable development practice holds the potential to attenuate these irrevocable trends, thereby cultivating a more resilient and prosperous milieu for future societies. There is a discernible global trend wherein an increasing number of organizations and nations are assimilating sustainable development into their strategic planning, thereby ensuring sustainable economic growth, social equity, and environmental preservation (Sachs et al., 2022).

Concomitant with the perpetual evolution of the sustainable development paradigm, there has been a transformative shift in the landscape of public management innovation. The application of data mining techniques and extensive modeling methodologies through artificial intelligence serves to alleviate the human cognitive load, thereby enhancing the efficiency of management practices. Intelligent decision support empowers public managers to conduct a more exhaustive and precise evaluation of the sustainability of policies and projects. By delving into profound analyses of big data, it furnishes astute decision support, averting arbitrary decision-making, streamlining resource allocation, and fostering sustainable development across social, economic, and environmental domains (Latysheva et al., 2021). Artificial intelligence, leveraging machine learning and deep learning methodologies across diverse sectors, has ushered in innovation and augmentation. In medicine, Support Vector Machines for machine learning and Convolutional Neural Networks for deep learning have found extensive utility in cancer classification and medical image recognition, affording medical practitioners more precise diagnostic and therapeutic avenues. Similarly, machine learning methodologies like random forests are deployed within the financial domain for credit scoring, whereas deep learning recurrent neural networks exhibit commendable prowess in processing time series data, which furnishes financial institutions with more accurate risk management and facilitates intelligent investment decisions (Yeh et al., 2021).

In harnessing the potential of contemporary public digital resources for the realization of sustainable development, it is imperative to harness the full spectrum of data functionalities judiciously, employing suitable methodologies. Employing Convolutional Neural Networks (CNN), the efficient analysis of large-scale remote sensing images facilitates monitoring urban greening and land cover, which elevates map production accuracy and furnishes more comprehensive spatial insights essential for urban planning, thereby fortifying sustainable urban development (Nam et al., 2020). Analogously, the integration of recurrent neural networks (RNN) and Long Short-Term Memory Networks (LSTM) for processing time series data enables the prediction of energy demand, traffic flow, and the like, which augments the precision of information pertinent to urban planning and resource allocation, aligning with the trajectory of sustainable urban development. A noteworthy innovation lies in the application of Generative Adversarial Networks (GAN) in public resource data, facilitating data synthesis to bridge gaps or model diverse decision-making scenarios (Goralski & Tan, 2020).

Consequently, the achievement of sustainable development for service platforms hinges on maximizing the utilization of diverse user-generated data. In this study, we delve into the review data concerning green news within public data resources, undertaking sentiment classification of users. This endeavor serves as a compass for the formulation of future sustainable development strategies. The specific contributions of this paper unfold as follows:

  1. 1.

    By leveraging the distinctive attributes of textual comment data within public digital repositories, the extraction and pre-processing of news content related to sustainable development, alongside its corresponding comments, have been meticulously executed using advanced crawler technology.

  2. 2.

    An innovative sentiment classification methodology, based on BERT word vectors and the PSO-LSTM paradigm, is introduced for text-centric data. This methodology not only represents a pioneering approach but also provides a conceptual framework for the sustainable development of public resource data.

  3. 3.

    A comprehensive model testing phase, employing the proposed PSO-LSTM methodology, has been conducted on publicly available datasets. The resulting sentiment classification outcomes demonstrate commendable performance on both the public dataset and the autonomously devised dataset, confirming the robustness and efficacy of the proposed approach.

In the remainder of this paper, related work is described in the “Related Works” section. The “Methodology” section establishes the PSO-LSTM. Experiment results and related analysis are illustrated in the “Experiment Result and Analysis” section, and the “Discussion” section discusses the research significance.

Related Works

Emotional analysis plays a crucial role in the analysis of resource data on public platforms. By conducting sentiment analysis on public platform data resources, we can gain a deeper understanding of users’ emotional tendencies under different topics, thereby better understanding the public’s attitudes and emotional responses to specific issues or events. To achieve this goal, we need to use text-based sentiment analysis techniques. This involves constructing deep network models for sentiment analysis of text data. In this process, we not only need to build a deep learning model suitable for text sentiment analysis but also need to continuously improve the accuracy and performance of the model through existing model optimization methods. Therefore, in this chapter, we will provide a detailed introduction to the methods of text sentiment extraction and how to improve sentiment analysis models through various optimization methods to more accurately analyze and understand emotional information in public platform resource data, thereby providing decision-makers with more comprehensive and accurate data support.

2.1 Research on Meta-Heuristic Algorithms

Meta-heuristic algorithms, also recognized as intelligent optimization algorithms, have emerged as a consequential facet of problem-solving methodologies inspired by nature and meticulously designed by human ingenuity over the past few decades (Yazdani & Jolai, 2016). Professor Holland from the University of Michigan pioneered this domain by conceptualizing genetic algorithms, a simulation of natural selection and hereditary mechanisms. This optimization algorithm evolves a population through successive generations, mimicking gene crossover, mutation, and selection operations to ascertain optimal or near-optimal solutions for complex problems. Rooted in genetic inheritance and evolutionary biology principles, genetic algorithms find widespread application in tackling intricate optimization challenges (Holland, 1975).

Farmer et al. (1986) introduced an artificial immune system algorithm, drawing from the tenets of the immune network doctrine. Inspired by ants’ foraging behavior, Dorigo (1992) proposed the ant colony algorithm. Eberhart and Kennedy (1995), influenced by bird migration patterns, conceived the particle swarm algorithm. Numerous nature-inspired optimization algorithms have emerged, including the reorganized frog hopping algorithm, the firefly algorithm, and the cuckoo search algorithm (Abdel-Basset et al., 2018). The application of corresponding meta-inspired algorithms in optimizing machine learning and deep learning models spans diverse fields.

In the medical domain, Wang and Chen (2020) proposed the whale optimization algorithm (CMWOA), integrating chaos strategy and multi-cluster strategy. This algorithm outperforms competitors in classification performance and feature subset size analysis for breast cancer, diabetes, and erythema squamosum cells. Yan et al. (2017) amalgamated genetic algorithm optimization with BP neural networks in industrial manufacturing, reducing prediction errors and enhancing stability in forecasting the bonding force between concrete and composite steel reinforcement skeleton. Energy prediction and route-finding research witnessed the introduction of the chaotic mayfly algorithm by Sennan et al. (2021) to obtain proton exchange membrane fuel cell parameters. Majumdar et al. (2021) employed a multi-objective mayfly algorithm to optimize hydrothermal solar wind scheduling, minimizing power generation costs for thermal generating units. Sennan et al. (2021) proposed a dynamic mobility-aware clustering-based routing protocol using the mayfly algorithm for channel selection, optimizing network lifetime, and minimizing end-to-end delay for vehicles.

The aforementioned investigation underscores that despite the advanced maturity of deep learning applications across diverse domains, the predominant choice among researchers remains the further optimization of model parameters through meta-heuristic algorithms. This strategic preference is rooted in the pursuit of obtaining optimal solutions for current models. Therefore, leveraging meta-heuristic algorithms for the optimization of machine learning and deep learning models emerges as a pivotal approach, promising a substantial enhancement in computational performance and task efficiency. The meta-heuristic algorithms can also be used to update the parameters in different kinds of networks to enhance the model performance.

Text Sentiment Classification Research

Online user comments, a pivotal component of User Generated Content (UGC), encompass commentaries disseminated by internet users in response to various stimuli. The surge in social platforms and e-commerce websites has led to a rapid proliferation of online comment texts. However, the sheer volume and redundant content present a formidable challenge in extracting valuable information from these texts (Senecal & Nantel, 2004). Zhuang et al. (2006) categorized features in online movie comment texts into movie elements and movie characters. Pang et al. (2002) discerned features in online movie comment texts by manually labeling commonly used emotion words and utilizing emotion word frequency as features for emotion classification. Their experiments, employing classification algorithms like Support Vector Machine and Simple Bayes, underscored the efficacy of SVM classifiers. Zhou et al. (2016) devised the Chinese microblog viewpoint mining system, CMiner, concentrating on viewpoint target extraction and summarization. Context-aware cutting was employed to enhance textual disambiguation, with nouns as viewpoint candidate sets. Viewpoints were subsequently extracted through an unsupervised label propagation algorithm for viewpoint candidate set sorting. Chinsha and Joseph (2015) engaged in viewpoint mining based on syntactic dependency analysis, combining scores of viewpoint words, SentiWordNet, aspectual lexicon, adverbial adjectives, adverb-verb combinations, adjectives, and verbs for automated viewpoint mining.

Pang et al. (2002) conducted automatic mining of viewpoints using Simple Bayes, Maximum Entropy, and Support Vector Machines, employing text unigram feature vectors for chapter-level sentiment classification. Support Vector Machines yielded superior results in chapter-level sentiment analysis. Tan et al. (2011) introduced a sentence sentiment polarity prediction model (PPM), integrating dependency analysis, subjective phrase analysis, word strength, and domain terminology for sentence-level sentiment tendency analysis, yielding commendable results. Zhang et al. (2009) proposed a rule-based text sentiment analysis method, performing sentence-level sentiment analysis based on word dependency. Liu (2012) structured unstructured text and defined product review sentiment as a quintet, encompassing the evaluation object, attributes of the evaluation object, sentiment corresponding to the attributes, emotion, sentiment holder, and posting time. Their extraction experiments demonstrated the effectiveness of this quintet framework.

The aforementioned research highlights the nuanced evolution of text mining, progressing from rudimentary word and sentence analysis to more intricate endeavors such as text topic extraction, classification, and sentiment analysis. This refinement in analysis underscores the continuous advancement of deep learning technology in text mining research. In the realm of public resource optimization, directing attention toward the nuanced analysis of user-generated textual digital data, specifically conducting refined sentiment analysis, proves both feasible and consequential. Such an approach plays a pivotal role in advancing sustainable development. Consequently, this paper delves into the examination of digital text resources within public management, embarking on a comprehensive analysis of news and commentaries associated with green sustainable development through the utilization of deep learning technology.

Methodology

Based on the requirements for model building, we will provide a detailed introduction to the method of constructing word vectors, the feature extraction method LSTM for text word vector data, and the optimization process of both in this chapter. The specific content is as follows.

Word Vector Construction

Word vectors, representing words as vectors of real numbers, constitute a crucial concept in natural language processing. Traditional representations like One-Hot Encoding portray words in high-dimensional sparse vectors, neglecting the semantic interrelations between words. To address this limitation, word vector models aim to bring semantically akin words closer in the vector space, enhancing the capture of semantic information between them. Classic models in this category include Word2Vec and GloVe (Global Vectors for Word Representation).

Word2Vec learns the distributional relationship of each word by training a neural network to derive a distributed representation that emphasizes contextual context. In contrast, GloVe encodes global word co-occurrence information into word vectors using matrix decomposition based on global statistical information. These approaches yield denser and semantically enriched word representations, enhancing the efficacy of various natural language processing tasks.

BERT (Bidirectional Encoder Representations from Transformers) represents a significant advancement in natural language processing. It achieves bidirectional context modeling through the self-attention mechanism in the Transformer architecture (Koroteev, 2021). Unlike traditional word vector models, BERT pre-trained models comprehensively consider the context of all words in a sentence when processing contextual information. This unique capability affords BERT a substantial advantage in understanding semantic relationships and addressing diverse natural language processing tasks. The structure of the BERT model is depicted in Fig. 1.

Fig. 1
figure 1

The framework for the BERT

The BERT model employs a bi-directional Transformer as a robust encoder, demonstrating enhanced semantic representation in two distinct phases: pre-training and fine-tuning. In the pre-training phase, the model acquires bi-directional contextual word representations through the Masked Language Model (MLM) task. During this task, a subset of the vocabulary is randomly chosen and masked in the training data, prompting the model to predict these masked words based on other words within the context. Another pre-training task integral to BERT is the Next Sentence Prediction (NSP) task. In this task, the model is presented with a pair of sentences, each with a certain probability of being adjacent to the original sentence and a certain probability of originating from a different text. The model’s objective is to discern whether the two sentences are adjacent. This task contributes to the model’s comprehension of logical relationships and contextual nuances between sentences.

Following the completion of training, the BERT model undergoes a fine-tuning phase where its parameters are adjusted. Fine-tuning tasks encompass a diverse range of natural language processing applications, such as text categorization, named entity recognition, question and answer, and more. The primary objective of fine-tuning is to tailor the model to a particular task’s specific context and objectives. Fine-tuning the BERT model involves preparing the dataset and adjusting the model structure. Firstly, select the corresponding dataset based on the task type and ensure that it conforms to the model input format. Then, fine-tuning the BERT model according to task requirements may require adjusting the output layer or adding additional layers. Next, clearly define the fine-tuning task objectives, such as classification labels or entity categories. Finally, select appropriate fine-tuning parameters and begin the fine-tuning process, continuously optimize model performance, and ultimately evaluate model performance on the test set and perform tuning. Through supervised training on task-specific datasets, BERT demonstrates adaptability across various applications, leveraging the generalized language representations acquired during the extensive pre-training phase. The attention mechanism, an inherent component of the Transformer architecture, plays a pivotal role in this process. The attention mechanism in the encoding unit is defined as shown in Eq. (1) for the attention mechanism:

$$\text{Attention }({\text{Q}},{\text{K}},{\text{V}})=\text{softmax}\left(\frac{Q{K}^{T}}{\sqrt{{d}_{k}}}\right){\text{V}}$$
(1)

where Q is the query vector, K and V are the key vector and value vector, respectively, and dk is the vector input dimension. In the BERT model, to enhance the model’s ability to focus on different positions and increase the “representation subspace” of the attention units, the Transformer adopts the Multi-Head Attention (MHA) mechanism to enhance the model performance. Attention to accomplish the performance enhancement of the model is calculated as shown in Eqs. (2) and (3):

$$\text{Multihead }({\text{Q}},{\text{K}},{\text{V}})= \text{Concat}\;\left({\text{ head }}_{1},\dots ,{\text{ head }}_{k}\right){W}^{\text{n}}$$
(2)
$${\text{head }}_{i}={\text{Attention}}\left({{\text{QW}}}_{i}^{Q},{{\text{KW}}}_{i}^{K},{{\text{VW}}}_{i}^{V}\right)$$
(3)

In addition to the self-attentive sublayer, each layer of EnCoder and DeCoder in the Transformer unit contains a fully connected Feed Forward network, which is defined as shown in Eq. (4):

$${\text{FFN}}(x)={\text{max}}\left(0,x{W}_{1}+{b}_{1}\right){W}_{2}+{b}_{2}$$
(4)

where \({W}_{1}\) and \({W}_{2}\) are the corresponding weights and b is the corresponding bias size. Enhanced by the bi-directional Transformer module, the BERT language model makes full use of the contextual information of each word so that a better-distributed representation can be obtained.

LSTM

Long Short-Term Memory (LSTM) is a variant of recurrent neural networks (RNNs) engineered to address the challenge of long sequence dependencies afflicting traditional RNNs. Standard RNNs often grapple with the issues of gradient vanishing or gradient explosion, impeding their ability to capture crucial information in extended sequences (Shi et al., 2022).

LSTM tackles these challenges by incorporating a gating mechanism and leveraging well-designed memory units and gates. This architectural refinement allows LSTM to adeptly handle long-term dependencies, mitigating the limitations associated with standard RNNs. The specific structure of LSTM is visually depicted in Fig. 2.

Fig. 2
figure 2

The LSTM cell

The integral components of LSTM comprise the input gate, forget gate, output gate, and memory cell. These components collaboratively enable LSTM to selectively retain or discard information, enhancing its capacity to effectively process prolonged sequences of data. Using the example of the LSTM sequence input at time t, let us delve into the calculation process of the input gate, as illustrated in Eq. (5):

$${i}_{t}=\upsigma \left({W}_{ii}{x}_{t}+{b}_{ii}+{W}_{hi}{h}_{t-1}+{b}_{hi}\right)$$
(5)

The calculation of the forgetting gate can be performed by Eq. (6)

$${f}_{t}=\sigma \left({W}_{if}{x}_{t}+{b}_{if}+{W}_{hf}{h}_{t-1}+{b}_{hf}\right)$$
(6)

After calculating the input gate and forgetting gate data, we can update the departmental cell to get

$${c}_{t}={f}_{t}\odot {c}_{t-1}+{i}_{t}\odot {\tilde{c}}_{t}$$
(7)

Thus, the output of the output gate (8) and the final output (9) are obtained.

$${o}_{t}=\sigma \left({W}_{io}{x}_{t}+{b}_{io}+{W}_{ho}{h}_{t-1}+{b}_{ho}\right)$$
(8)
$${h}_{t}={o}_{t}\odot {\text{tanh}}\left({c}_{t}\right)$$
(9)

Of these, the \({W}_{ii},{W}_{if},{W}_{io},{W}_{ic}\) and \({W}_{hi},{W}_{hf},{W}_{ho},{W}_{hc}\) are the weight matrices, the \({b}_{ii},{b}_{if},{b}_{io},{b}_{ic}\) and \({b}_{hi},{b}_{hf},{b}_{ho},{b}_{hc}\) are bias vectors, \(\upsigma\) is the sigmoid function, and \({\text{tanh}}\) is the hyperbolic tangent function. Through the above process, we can get the output of the model under the LSTM network.

Meta-Heuristic Algorithm and PSO-LSTM

To enhance the optimization of model parameters, we employ a meta-heuristic algorithm within the class of sophisticated algorithms. The intricacies arise from the coexistence of diversity, uncertainty, and correlation inherent in the model parameter values (Ren et al., 2021). Formulating the model parameters becomes exceedingly intricate due to these factors. The objective of the optimization problem is to identify a collection of parameter solutions that adhere to specified constraints. This collection of solutions must align with the optimality measure of the problem, ensuring that the overall system’s performance index reaches its zenith under given conditions. The comprehensive process can be elegantly captured through Eq. (10):

$$\begin{array}{c}{\text{min}}/{\text{max}}\{F(x)=({f}_{1}(x),{f}_{2}(x),{f}_{3}(x),\cdots ,{f}_{m}(x))\}\\ \text{ s.t. x}\in\text{S} = \{x\mid {g}_{i}(x)\le 0,i=1,2,\cdots m\}\end{array}$$
(10)

Here, F(x) represents the objective function slated for optimization, while g(x) encapsulates the constraint function, with x symbolizing the decision variable. In tackling the nuances of multi-objective optimization problems, it is crucial to acknowledge potential contradictory relationships among the objective functions. Consequently, the solution process must delicately balance these contradictions, ensuring that all m objective functions concurrently attain optimal values. In the context of this study, the optimization of the LSTM model is undertaken by employing the particle swarm optimization method. The formal depiction of the particle swarm algorithm unfolds as follows: the swarm comprises m particles, navigating through a D-dimensional space to resolve the problem at hand. That is, the population \(=\left\{{x}_{1}^{(k)},{x}_{2}^{(k)},\cdots ,{x}_{m}^{(k)}\right\}\), where \(k\) refers to the current moment, the first \(i\). It is the position of the first particle in the \(D\). The position of the particle in the dimensional space can be described as \({x}_{i}^{(k)}=\left({x}_{i1}^{(k)},{x}_{i2}^{(k)},\cdots ,{x}_{id}^{(k)}\right)(i=1,2,\cdots ,m)\), which is the position of one of the particles at \(k\). This is the position of one of the particles at the current moment and a possible solution to the problem. The particle moves continuously to find the optimal position for solving the problem \({v}_{i}^{(k)}=\left({v}_{i1}^{(k)},{v}_{i2}^{(k)},\cdots ,{v}_{id}^{(k)}\right)(i=1,2,\cdots ,m),{v}_{i}^{(k)}\). The velocity vector can describe the motion of the particle in each dimension of the space. When we know the current state of particle motion and carry out the next stage of particle updating, the process can be expressed by Eqs. (11) and (12):

$${v}_{id}^{(k+1)}=\omega \cdot {v}_{id}^{(k)}+{c}_{1}\cdot {r}_{1}\cdot \left({p}_{id}^{(k)}-{x}_{id}^{(k)}\right)+{c}_{2}\cdot {r}_{2}\cdot \left({p}_{id}^{(k)}-{x}_{id}^{(k)}\right)$$
(11)
$${x}_{id}^{(k+1)}={x}_{id}^{(k)}+{v}_{id}^{(k+1)}$$
(12)

where \(\upomega\) denotes the inertia factor, \({c}_{1},{c}_{2}\) denotes the acceleration factor of the particle, \({{\text{r}}}_{1},{{\text{r}}}_{2}\) is \((0,1)\) that is the random number between \({x}_{id}^{(k)}\) and is the current position vector of the particle, \({v}_{id}^{(k)}\) is the velocity vector of the particle motion, and \({p}_{id}^{(k)}\) denotes the positional optimum of the individual particle. Equation (13) needs to be satisfied when the particle searches for velocity in space:

$${v}_{id}^{(k+1)}\le {V}_{{\text{max}}}$$
(13)

In essence, ensuring that the particle velocity remains within the confines of the maximum velocity vector limit is imperative. We can discern the optimal solution by systematically updating the particles’ velocity and position. Thus, through the fusion of the LSTM method and the PSO algorithm, incorporating BERT vector inputs, we can establish a sophisticated PSO-LSTM model for the sentiment analysis of public digital resource text information. The input value of the BERT vector is usually in the form of word embeddings from both upper and lower cultures. These embeddings represent each word in the input text, with the context being the entire sentence or document. The BERT model utilizes bidirectional context to generate these embeddings and capture rich semantic information. The delineated model framework is visually presented in Fig. 3.

Fig. 3
figure 3

The framework for the proposed PSO-LSTM

Similar to the unoptimized model, the training of the model commences with the division of the dataset into distinct training and test sets. The crux of particle swarm optimization manifests primarily during the mechanical training process, where it dynamically explores optimization avenues. The initial phase of the BERT model framework involves the analysis of processed data, subsequently channeled into the LSTM model for supervised training. Following this, the relevant loss function value is computed, and if it falls short of the predetermined threshold, the particle swarm undergoes an update.

A vector is formulated within the particle swarm updating process, encompassing neuron configuration, batch size, and learning rate, exemplifying the optimization parameters. Initialization of particles starts the optimization process, with the initialized value vector assigned to the LSTM as the historical optimum. Training ensues until the stipulated loss function threshold is met, prompting the cessation of training and yielding the ultimate optimized model.

Experiment Result and Analysis

After completing the model construction, we need to train the model and evaluate the results. Therefore, in this chapter, we will provide a detailed introduction to the data used and its characteristics, as well as some relevant comparison models and indicators.

Dataset and Data Pre-Processing

Upon concluding the model construction, the subsequent step entails rigorous testing and analysis. The focal point of this paper centers on theme extraction and user sentiment analysis concerning text data within public digital resources. This inquiry seeks to delve into the nuanced exploration of policies related to sustainable development. Consequently, our selection of datasets for analysis encompasses news and reviews, specifically opting for sentiment classification datasets comprising BBC News Summary and IMDb Movie Review. A detailed breakdown of the pertinent information for the two datasets is outlined in Table 1.

Table 1 The specific information for the employed dataset

Upon dataset confirmation, the subsequent step involves pertinent data pre-processing. Initial measures include the removal of stopwords, filtering out all punctuation marks, and discarding irrelevant special characters from the text. The focus is on retaining Chinese and English texts encapsulating substantive semantic information. Subsequently, the BERT model is employed to construct and train word vectors, facilitating effective data input.

Precision, recall, and F1-score are the selected metrics in the model evaluation process outlined in this paper. The calculation of these metrics is elucidated in Eqs. (14)–(16):

$$Precision=\frac{TruePositive}{TruePositive+FalsePositive}$$
(14)
$$Recall=\frac{TruePositive}{TruePositive+FalseNegative}$$
(15)
$$F1-score=\frac{{2}^{*}Precisio{n}^{*}Recall}{Precision+Recall}$$
(16)

where TruePositive represents the count of correctly identified emotions, FalsePositive signifies the instances where positive emotions are erroneously classified as negative, and FalseNegative indicates the count of emotions that eluded accurate recognition. The specific information for the network establishment is given by Table 2.

Table 2 The specific information for the LSTM layers

Experiment Result in Public Digital Resources

Upon completing the model construction and relevant data description, we initiated the performance assessment of the model using a public dataset. The analysis focused on the recognition of two emotional categories: positive and negative. The results, depicted in Figs. 4 and 5, elucidate the outcomes of this evaluation.

Figure 4 presents the emotional recognition outcomes for news documents under the BBC News dataset. The data indicates that the PSO-optimized LSTM model, as proposed in this paper, enhances the recognition efficacy of LSTM to a notable extent. Following optimization, the recognition rates for distinct emotions reach 0.912 and 0.883, surpassing the unoptimized approach. Concurrently, the model exhibits a more balanced overall performance, demonstrating greater average accuracy in precision and recall.

Fig. 4
figure 4

The recognition result on the BBC News Summary dataset

After completing the sentiment analysis under the BBC dataset, we conducted the test of sentiment recognition analysis under the IMDb review dataset, and the results are shown in Fig. 5.

Fig. 5
figure 5

The recognition result on IMDb Movie Reviews: dataset

In Fig. 5, the recognition precisions of the PSO-LSTM method, as applied in this paper, stand at 0.893 and 0.886 for positive and negative emotions, respectively. These values surpass the traditional recurrent neural network and the singular LSTM method. Furthermore, the average precisions exhibit a more balanced distribution for both types of emotions, underscoring the superior performance of the model under the public dataset.

Practical Test in the Public Digital Resources Concerning Sustainable Development

Given the primary objective of conducting textual sentiment analysis on sustainable development content within public resource data, a dedicated dataset was curated for testing purposes. In this self-constructed dataset, comments pertaining to sustainable development-related news were extracted, incorporating keywords such as sustainable, green, and low carbon. Leveraging web crawling techniques facilitated the acquisition of pertinent content. Subsequent to data pre-processing applied to the textual comment data, model training was executed following the process delineated in Fig. 3. To visually comprehend the model enhancement facilitated by the PSO method, the evolution of the loss function under our self-constructed data is depicted in Fig. 6.

Fig. 6
figure 6

The loss of the LSTM and proposed PSO-LSTM on the established dataset

Figure 6 shows the impact of the increase in iteration, showcasing accelerated convergence speed after PSO optimization. The final loss is marginally superior to that of LSTM alone. This observation suggests, to a certain extent, the method’s efficacy in mitigating local optimal solution challenges and enhancing overall model performance. Following the comparative analysis of loss function variations, further insights are presented in Fig. 7.

Fig. 7
figure 7

The recognition result on the established dataset

In Fig. 7, the recognition rates of the proposed method outlined in this paper stand at 0.946 and 0.937 for positive and negative sentiments, respectively. These results signify superior recognition performance and a more balanced performance in terms of F1-score. Additionally, a comparative analysis of the optimization effects under different meta-inspired algorithms is presented in Fig. 8.

Fig. 8
figure 8

The comparison result on the established dataset using different optimization

Figure 8 shows that across various meta-heuristic algorithms applied to the self-constructed dataset, each contributes to an enhanced model performance and mitigates the risk of local optima. The metrics encompassing precision, recall, and others illustrate the average recognition results for the two emotional categories under different methods. Upon scrutiny of the outcomes, it becomes evident that the method proposed in this paper surpasses the optimization effects achieved by meta-heuristic algorithms like SA and GA to a certain extent. These results underscore the practical advancement of the proposed method in real-world applications. To give a more comprehensive information for the proposed model, we have compared the training time for the model, which is shown in Table 3.

Table 3 The training time for the method

It can be seen from Table 3 that the training time for these models is similar, but the precision for the PSO is higher than others.

Discussion

This paper successfully conducts sentiment analysis within sustainable development by drawing on news and related comments from public digital resources. It achieves a high-precision sentiment classification for both positive and negative sentiments, laying the groundwork for future sustainable ecological platform development. Furthermore, this research ensures increased adaptability to evolving public sentiment. Employing a meta-heuristic algorithm to optimize LSTM in the emotion classification process, the paper makes significant strides in text emotion classification, notably improving performance (Liu et al., 2021). The study reveals PSO as a superior performer compared to SA and GA methods. PSO exhibits enhanced convergence to globally optimal solutions, simulating a collaborative search process among particles in a population. Its flexibility within the search space and intelligent parameter adjustment set it apart from traditional SA and GA methods, optimizing model performance more efficiently. This study underscores the efficacy of PSO as a meta-inspired algorithm for deep learning tasks, accelerating model training and achieving superior text sentiment classification performance (Shang et al., 2021).

By meticulously collecting data related to sustainable development from public resource platforms, public management platforms can attain a more comprehensive understanding of the dynamic shifts in society, the economy, and the environment, which, in turn, empowers them to formulate policies and plans with greater accuracy, fostering the realization of sustainable development goals. These data serve as a scientific foundation for government decision-makers and contribute to providing transparent and credible information for the community, which promotes democratization and participation of public management. To address challenges and enhance the effectiveness of these efforts, measures should be taken to improve data quality and usability. Technical means, such as real-time monitoring and analysis, should be deployed to strengthen data oversight. Concurrently, robust laws, regulations, and ethical guidelines must be established to safeguard data privacy and security, bolstering public trust in data collection and use. Initiatives promoting information sharing and collaboration among departments are crucial to breaking down information silos, facilitating global data integration, and better serving the overarching strategy of sustainable development. Through the implementation of these countermeasures, public management platforms can optimize the value derived from data, fostering societal progress toward sustainable development.

Conclusion

Based on the comprehensive content and experimental results of this study, we have proposed a text sentiment classification framework based on BERT word vectors and PSO-LSTM optimization for user sentiment analysis on public service platforms. Through model testing on the BBC News and IMDb datasets, the results indicate that the model, optimized with PSO, demonstrates improvement in sentiment recognition. The average precision of identifying positive and negative sentiments on the public dataset is 0.903 and 0.885, respectively, surpassing the standalone LSTM method. Moreover, on a self-built dataset of sustainable development comments in public management processes, the model achieves an average precision of 0.942, also outperforming the single-method approach. This suggests that the PSO algorithm effectively enhances model performance. Additionally, a comparative analysis of different meta-heuristic algorithms reveals that the PSO method exhibits superior optimization effectiveness.

In terms of applications, this sentiment classification framework can provide public management decision-makers with more comprehensive and accurate user sentiment information, thereby facilitating the optimization of public service strategies and measures, and promoting the sustainable development of public management. However, the model still has some limitations, such as potential performance degradation when handling long texts and potential inaccuracies in sentiment expression in certain specific domains. Future development trends include further improving the model’s generalization ability, enhancing its adaptability to different domains and contexts, and exploring more effective optimization methods and richer sentiment classification techniques to better address complex real-world scenarios.