Skip to main content

tweetopic

⚡ Blazing Fast topic modelling over short texts in Python

PyPI version pip downloads python version Code style: black

Features

  • Fast ⚡
  • Scalable 💥
  • High consistency and coherence 🎯
  • High quality topics 🔥
  • Easy visualization and inspection 👀
  • Full scikit-learn compatibility 🔩

🛠 Installation

Install from PyPI:

pip install tweetopic

👩‍💻 Usage (documentation)

Train your a topic model on a corpus of short texts:

from tweetopic import DMM
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.pipeline import Pipeline

# Creating a vectorizer for extracting document-term matrix from the
# text corpus.
vectorizer = CountVectorizer(min_df=15, max_df=0.1)

# Creating a Dirichlet Multinomial Mixture Model with 30 components
dmm = DMM(n_components=30, n_iterations=100, alpha=0.1, beta=0.1)

# Creating topic pipeline
pipeline = Pipeline([
    ("vectorizer", vectorizer),
    ("dmm", dmm),
])

You may fit the model with a stream of short texts:

pipeline.fit(texts)

To investigate internal structure of topics and their relations to words and indicidual documents we recommend using topicwizard.

Install it from PyPI:

pip install topic-wizard

Then visualize your topic model:

import topicwizard

topicwizard.visualize(pipeline=pipeline, corpus=texts)

topicwizard visualization

🎓 References

  • Yin, J., & Wang, J. (2014). A Dirichlet Multinomial Mixture Model-Based Approach for Short Text Clustering. In Proceedings of the 20th ACM SIGKDD International Conference on Knowledge Discovery and Data Mining (pp. 233–242). Association for Computing Machinery.

Metadata

Release files for tweetopic 0.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tweetopic 0.4.0
File Size Uploaded Provenance
tweetopic-0.4.0.tar.gz 12.9 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for tweetopic 0.4.0
File Interpreter ABI Platform
tweetopic-0.4.0-py3-none-any.whl Python 3 none any Details

Total release size: 28.9 kB

Release files / tweetopic-0.4.0.tar.gz

Download URL tweetopic-0.4.0.tar.gz
Size 12.9 kB
Tags Source
SHA-256 checksum
How to use checksums
6dce0275cb2963665bc612895e17c3f6b7c6a40abe85a0a21acb2513eed06994
BLAKE2b-256 checksum
How to use checksums
8e9f1f413152c3550aa099836a932260556bb2aa934ab74db5ba1b020582e922
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.7.1 CPython/3.11.5 Linux/5.15.0-107-generic

Release files / tweetopic-0.4.0-py3-none-any.whl

Download URL tweetopic-0.4.0-py3-none-any.whl
Size 15.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
214c80452c95c16c7718bc2031517ec79210ae200c96d186a8dd3fd47f1ae93e
BLAKE2b-256 checksum
How to use checksums
4c6541ee278b600aa9a10ec7b47e3119f000b113fc8bfb0e7090b92ee5b24968
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.7.1 CPython/3.11.5 Linux/5.15.0-107-generic

Security for tweetopic 0.4.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page