contextualized-topic-models
A python package for contextualized topic modeling using BERT and other embeddings.
GraphCanon updated 4w · GitHub synced 4w
Decision brief
Contextualized-topic-models is a Python package that enhances traditional topic modeling by integrating contextualized embeddings like BERT.
Good fit when
- - When you need to analyze text data with enriched topic coherence provided by models utilizing BERT-like embeddings.
- - For research or development in NLP where multilingual or neural-specific topic analysis is required, as published in EACL and ACL 2021 by Bianchi et al.
Avoid when
- - If your project does not require advanced contextual embedding integration and more conventional topic modeling techniques suffice.
- - In scenarios where model complexity can be a bottleneck for real-time processing or when working with hardware limitations that cannot efficiently process BERT embeddings.
Observed Jul 12, 2026 · Source: enrich:decision_facts
Verify the decision
Maintenance and security
Full trust report- Maintenance
- Slowing (363d since push)
- As of 4w
- Provenance
- Not a fork · Organization account
- As of 4w
- Security (OSV)
- No lockfile
- As of 1mo
Public GitHub metadata and optional OSV scans. Signals, not a guarantee. Trust methodology.
Install
pip install contextualized-topic-models PyPISimilar tools
Same-category neighbours. No typed graph edges are catalogued for this tool yet.
Evidence and technical details
Sourced facts, taxonomy, compatibility claims, README excerpt, and machine-readable endpoints.
Overview
This repository offers tools to combine contextualized embeddings like those from BERT with traditional topic models, enhancing the coherence of discovered topics. It is published in EACL and ACL 2021 by Bianchi et al., making it a valuable resource for researchers and developers working on advanced topic modeling within natural language processing.
Capability facts
- Languages
- python
Source: github.language · Jul 23, 2026
Categories
Compatibility
Sourced claims from the README excerpt - not unsourced marketing copy.
Source: README excerpt (regex_v1, Jul 23, 2026)
:target: https://pypi.python.org/pypi/contextualized_topic_modelsSource link
Tags
README
=========================== Contextualized Topic Models
.. image:: https://img.shields.io/pypi/v/contextualized_topic_models.svg :target: https://pypi.python.org/pypi/contextualized_topic_models
.. image:: https://github.com/MilaNLProc/contextualized-topic-models/workflows/Python%20package/badge.svg :target: https://github.com/MilaNLProc/contextualized-topic-models/actions
.. image:: https://readthedocs.org/projects/contextualized-topic-models/badge/?version=latest :target: https://contextualized-topic-models.readthedocs.io/en/latest/?badge=latest :alt: Documentation Status
.. image:: https://img.shields.io/github/contributors/MilaNLProc/contextualized-topic-models :target: https://github.com/MilaNLProc/contextualized-topic-models/graphs/contributors/ :alt: Contributors
.. image:: https://img.shields.io/badge/License-MIT-blue.svg :target: https://lbesson.mit-license.org/ :alt: License
.. image:: https://pepy.tech/badge/contextualized-topic-models :target: https://pepy.tech/project/contextualized-topic-models :alt: Downloads
.. image:: https://colab.research.google.com/assets/colab-badge.svg :target: https://colab.research.google.com/drive/1fXJjr_rwqvpp1IdNQ4dxqN4Dp88cxO97?usp=sharing :alt: Open In Colab
.. image:: https://raw.githubusercontent.com/aleen42/badges/master/src/medium.svg :target: https://medium.com/towards-data-science/contextualized-topic-modeling-with-python-eacl2021-eacf6dfa576 :alt: Medium Blog Post
.. image:: https://img.shields.io/badge/youtube-video-red :target: https://www.youtube.com/watch?v=n1_G8K07KoM :alt: Video Tutorial
Contextualized Topic Models (CTM) are a family of topic models that use pre-trained representations of language (e.g., BERT) to support topic modeling. See the papers for details:
- Bianchi, F., Terragni, S., & Hovy, D. (2021).
Pre-training is a Hot Topic: Contextualized Document Embeddings Improve Topic Coherence. ACL. https://aclanthology.org/2021.acl-short.96/ - Bianchi, F., Terragni, S., Hovy, D., Nozza, D., & Fersini, E. (2021).
Cross-lingual Contextualized Topic Models with Zero-shot Learning. EACL. https://www.aclweb.org/anthology/2021.eacl-main.143/
.. image:: https://raw.githubusercontent.com/MilaNLProc/contextualized-topic-models/master/img/logo.png :align: center :width: 200px
Topic Modeling with Contextualized Embeddings
Our new topic modeling family supports many different languages (i.e., the one supported by HuggingFace models) and comes in two versions: CombinedTM combines contextual embeddings with the good old bag of words to make more coherent topics; ZeroShotTM is the perfect topic model for task in which you might have missing words in the test data and also, if trained with multilingual embeddings, inherits the property of being a multilingual topic model!
The big advantage is that you can use different embeddings for CTMs. Thus, when a new embedding method comes out you can use it in the code and improve your results. We are not limited by the BoW anymore.
We also have Kitty <https://contextualized-topic-models.readthedocs.io/en/latest/kitty.html>_! A new submodule that can be used to create a human-in-the-loop
classifier to quickly classify your documents and create named clusters.
.. image:: https://raw.githubusercontent.com/MilaNLProc/contextualized-topic-models/master/img/logo_kitty.png :align: center :width: 200px
Tutorials
You can look at our medium_ blog post or start from one of our Colab Tutorials:
.. |colab1_2| image:: https://colab.research.google.com/assets/colab-badge.svg :target: https://colab.research.google.com/drive/1fXJjr_rwqvpp1IdNQ4dxqN4Dp88cxO97?usp=sharing :alt: Open In Colab
.. |colab2_2| image:: https://colab.research.google.com/assets/colab-badge.svg :target: https://colab.research
For agents
This page has a .md twin and JSON over the API.