Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions bertopic/_bertopic.py
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,19 @@ def fit_transform(
documents, embeddings, assigned_documents, assigned_embeddings
)
else:
# Update topic id to zeroshot topic id mapping
self._topic_id_to_zeroshot_topic_idx = {
new_topic_id: zeroshot_topic_id
for new_topic_id, zeroshot_topic_id in enumerate(set(assigned_documents.Topic))
}

# All documents matches zero-shot topics
documents = assigned_documents
embeddings = assigned_embeddings

# Update topic sizes
self._update_topic_size(documents)

# All documents matches zero-shot topics
documents = assigned_documents
embeddings = assigned_embeddings
Expand Down