STREAM : Simplified Topic Retrieval, Exploration, and Analysis Module (2024)

Abstract: Topic modeling is a widely used technique to analyze large document corpora. With the ever-growing emergence of scientific contributions in the field, non-technical users may often use the simplest available software module, independent of whether there are potentially better models available. We present a Simplified Topic Retrieval, Exploration, and Analysis Module (STREAM) for user-friendly topic modelling and especially subsequent interactive topic visualization and analysis. For better topic analysis, we implement multiple intruder-word based topic evaluation metrics. Additionally, we publicize multiple new datasets that can extend the so far very limited number of publicly available benchmark datasets in topic modeling. We integrate downstream interpretable analysis modules to enable users to easily analyse the created topics in downstream tasks together with additional tabular information.The code is available at the following link: https://github.com/AnFreTh/STREAM

## introduction identifying latent topics within extensive text corpora is a fundamental task in the field of natural language processing (nlp) and has been of larger scientific interest since the early 2000s @xcite . especially with the emergence of contextualized embeddings, extraction algorithms and topic models continue to evolve and achieve increasingly impressive results in terms of topic coherence @xcite @xcite @xcite . even, methodologically simpler methods achieve state-ofthe-art results by leveraging document and wordembeddings @xcite @xcite . the publication of open source software like gensim @xcite , the natural language tool kit (nltk) @xcite or spacy @xcite have enabled researchers to apply such models in various fields, including education @xcite , offsite construction @xcite , bioinformatics @xcite , communication sciences @xcite , finance @xcite and numerous other applications (e.g., @xcite @xcite @xcite @xcite ). the octis (optimizing and comparing topic models is simple) @xcite framework in particular has found favor in the scientific community and made fitting and evaluating sophisticated topic models easy and efficient. however, octis lacks the methodologically simpler yet very performant models such as clustering based topic extraction @xcite and the user-centric implementation of bertopic @xcite . especially the user-friendly implementation and visualization possibilities of bertopic allow non-technical users to easily analyze their document corpora and visualize their results which has led to a variety of use cases especially in the social sciences (e.g. @xcite @xcite ). we thus contribute the stream (simplified topic retrieval exploration and analysis module) software package. it gets its acronym not only from the easy to use, user-centric topic modelling, evaluation and exploration implementation but also from the integration of downstream models to analyze topic contributions to regression or classification problems. the core of the stream package is built on top of the octis framework and allows seamless integration of all of octis' multitude of models, datasets, evaluation metrics and hyperparameter optimization techniques. ## model fitting and octis integration stream is effectively built upon the core concepts of the octis package and inherits from the abstractmodel, abstractmetric and octisdataset classes. thus, all models, evaluation metrics, visualization functions, datasets and downstream models are perfectly integrable with all of octis' models and metrics. datasets creating custom datasets including tabular data is as simple as running the following few lines of code: all textual data is preprocessed according to the users specifications of the preprocessing pipeline and therefore, e.g., lower cased, stopwords removed and lemmatized. in the specified directory, the necessary files and a .csv file storing the tabular data are saved. model fitting fitting a model (here e.g. a simple kmeans clustering topic model) can subsequently be done simply by running the following code: depending on the model, the hyperparameters can easily be adjusted. note, that all stream datasets are fully usable with all octis models and users can thus easily fit e.g. a lda @xcite or etm (dieng et al., 2020) on the tmdataset class. evaluation stream offers multiple new, intruder-word based topic evaluation metrics @xcite alongside classical npmi coherence scores @xcite , computed over the complete documents and not over sliding windows, and also embedding based coherence metrics @xcite . see the appendix for an overview over all available metrics. the evaluation of a model can thus be done by simply running: ## conclusion in this paper, we present the stream framework. a user-friendly topic modeling module for creating datasets, training and evaluating topic models, visualizing results and fitting interpretable downstream models. the proposed framework is a python library and closely interacts with the existing octis framework from @xcite . future adaptations could include the integration of further more performant or e.g. distributional downstream models @xcite @xcite to further allow researchers to analyze the effect a topic has on a regression or classification task.