# Investigating the Key Aspects of a Smart City through Topic Modeling and Thematic Analysis
## 2 Materials and Methods
### Topic Modeling  
Topic modeling is an automated, unsupervised technique that discovers the underlying topics within a collection of documents, along with the connections between each document and these topics [37]. The algorithms can achieve this with minimal human involvement, rendering the approach more deductive compared to the conventional techniques used in analyzing social and human science texts. While not flawless, when employed thoughtfully and executed with caution, the method appears to consistently produce plausible interpretations of the texts [38]. The output of topic modeling comprises two elements: the proportions of words within topics and the proportions of topics within documents. Upon completion of the training process, both output elements can be extracted from the model and subjected to human analysis [16]. Since topic modeling portrays each document as an intricate amalgamation of various topics and each topic as an intricate amalgamation of multiple words, it is also employed as a method to categorize documents according to the outcomes of inferred topics [34]. [PERSON] et al. [39] traced the evolution of topic modeling methods, dating back to 1990 when [PERSON] et al. [40] introduced latent semantic indexing (LSI). LSI employs singular value decomposition (SVD) on a large term-document matrix to identify a linear subspace that captures the connection between words and documents. Nevertheless, LSI has limitations, as it does not assign probabilities to topics. Addressing this, [PERSON] [41] developed probabilistic latent semantic indexing (pLSI), which also received criticism for its inability to account for the generative probabilistic models of documents. Consequently, LDA was conceived by [PERSON] et al. [42] as an advancement. Nevertheless, these conventional topic modeling methods have faced backlash due to their inability to manage data scarcity, a challenge particularly noticeable in concise texts. However, considerably more recent and advanced techniques like BERTopic [43] are swiftly gaining traction, especially in applications involving social media [11]. Unlike conventional topic models that depend on the \"Bag-of-Words\" representations, which disregard the inherent semantic connections among words by employing a mere lexical bag format, BERTopic, functioning as a neural topic model, has the capability to depict words as multidimensional vectors. This allows it to capture contextual information, resulting in more precise and comprehensive attributes [44]. BERTopic  
BERTopic was introduced by [PERSON] [43] as \"a topic model that leverages clustering techniques and a class-based variation in term frequency-inverse document frequency (TF-IDF) to generate coherent topic representations\". BERTopic demonstrated impressive performance in terms of two widely used validation measures, topic coherence (TC) and topic diversity (TD), in comparison to LDA, NMF, CTM, and Top2 Vec in three different benchmark datasets [45]. Furthermore, this approach demands less effort in hyperparameter tuning and does not necessitate a predetermined number of topics, providing BERTopic an advantage over LDA [44]. [PERSON] et al. [46] underscored two additional advantages of BERTopic in comparison to the alternative methods: its straightforward, out-of-the-box usability and its innovative, interactive visualization capabilities. BERTopic employs a modular architecture comprising five core sequential functions, illustrated in Figure 4.  
More specifically, the model:  
1. Converts a document to numerical representations in a vector space, known as embeddings, using a pre-trained language model. This process involves obtaining information at the document level. To fulfill this function, we employed the SBERT sentence transformer [47], which is a modified version of the pre-trained Bidirectional Encoder Representations from Transformers (BERT) network [48]. SBERT utilizes siamese and triplet network structures to generate semantically meaningful sentence embeddings.