tmtoolkit: Text mining and topic modeling toolkit

PyPI Version Downloads from PyPI Documentation Status GitHub Actions CI Build Status Coverage status Citable Zenodo DOI

tmtoolkit is a set of tools for text mining and topic modeling with Python developed especially for the use in the social sciences, linguistics, journalism or related disciplines. It aims for easy installation, extensive documentation and a clear programming interface while offering good performance on large datasets by the means of vectorized operations (via NumPy) and parallel computation (using Python’s multiprocessing module and the loky package). The basis of tmtoolkit’s text mining capabilities are built around SpaCy, which offers many language models. Currently, the following languages are supported for text mining:

  • Catalan

  • Chinese

  • Croatian

  • Danish

  • Dutch

  • English

  • Finnish

  • French

  • German

  • Greek

  • Italian

  • Japanese

  • Korean

  • Lithuanian

  • Macedonian

  • Norwegian Bokmål

  • Polish

  • Portuguese

  • Romanian

  • Russian

  • Spanish

  • Swedish

  • Ukrainian

The documentation for tmtoolkit is available on and the GitHub code repository is on


Text preprocessing and text mining

The tmtoolkit package offers several text preprocessing and text mining methods, including:

Wherever possible and useful, these methods can operate in parallel to speed up computations with large datasets.

Topic modeling

Other features


  • only languages are supported, for which SpaCy language models are available

  • all data must reside in memory, i.e. no streaming of large data from the hard disk (which for example Gensim supports)

Built-in datasets

Currently tmtoolkit comes with the following built-in datasets which can be loaded via from_builtin_corpus:

  • “en-NewsArticles”: News Articles (Dai, Tianru, 2017, “News Articles”,, Harvard Dataverse, V1)

  • random samples from ParlSpeech V2 (Rauh, Christian; Schwalbach, Jan, 2020, “The ParlSpeech V2 data set: Full-text corpora of 6.3 million parliamentary speeches in the key legislative chambers of nine representative democracies”,, Harvard Dataverse) for different languages:

    • “de-parlspeech-v2-sample-bundestag”

    • “en-parlspeech-v2-sample-houseofcommons”

    • “es-parlspeech-v2-sample-congreso”

    • “nl-parlspeech-v2-sample-tweedekamer”

  • “en-healthtweets”: Health News in Twitter Data Set

About this documentation

This documentation guides you in several chapters from installing tmtoolkit to its specific use cases and shows some examples with built-in corpora and other datasets. All “hands on” chapters from Getting started to Topic modeling are generated from Jupyter Notebooks. If you want to follow along using these notebooks, you can download them from the GitHub repository.

There are also a few other examples as plain Python scripts available in the examples folder of the GitHub repository.


Code licensed under Apache License 2.0. See LICENSE file.


Indices and tables