Created
January 5, 2021 12:16
-
-
Save MaartenGr/49e70d18517585fb83ed8e4eb148c193 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from bertopic import BERTopic | |
from sentence_transformers import SentenceTransformer | |
# Prepare embeddings | |
sentence_model = SentenceTransformer("distilbert-base-nli-mean-tokens") | |
embeddings = sentence_model.encode(docs, show_progress_bar=False) | |
# Create topic model | |
model = BERTopic() | |
topics, probabilities = model.fit_transform(docs, embeddings) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment