Created
January 5, 2021 12:17
-
-
Save MaartenGr/7b0f1ab542a3360b9e9b73c3331178d9 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 sklearn.feature_extraction.text import TfidfVectorizer | |
# Create TF-IDF sparse matrix | |
vectorizer = TfidfVectorizer(min_df=5) | |
embeddings = vectorizer.fit_transform(docs) | |
# Model | |
model = BERTopic(stop_words="english") | |
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