Skip to content

Instantly share code, notes, and snippets.

@MaartenGr
Created January 5, 2021 06:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MaartenGr/ad97059509487857e5ab98bed8585d3a to your computer and use it in GitHub Desktop.
Save MaartenGr/ad97059509487857e5ab98bed8585d3a to your computer and use it in GitHub Desktop.
from bertopic import BERTopic
from sklearn.datasets import fetch_20newsgroups
docs = fetch_20newsgroups(subset='all', remove=('headers', 'footers', 'quotes'))['data']
model = BERTopic()
topics, probs = model.fit_transform(docs)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment