Skip to content

Commit 0ed386c

Browse files
authored
Fix incorrect comparison in update_topics (#2336)
1 parent c5b4f9f commit 0ed386c

File tree

2 files changed

+1
-2
lines changed

2 files changed

+1
-2
lines changed

bertopic/_bertopic.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1574,7 +1574,7 @@ def update_topics(
15741574
self.topic_representations_ = self._extract_words_per_topic(words, documents)
15751575

15761576
# Update topic vectors
1577-
if set(topics) != self.topics_:
1577+
if set(topics) != set(self.topics_):
15781578
# Remove outlier topic embedding if all that has changed is the outlier class
15791579
same_position = all(
15801580
[

tests/test_bertopic.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,5 +152,4 @@ def test_full_model(model, documents, request):
152152
topic_model1 = BERTopic.load("model_dir")
153153
merged_model = BERTopic.merge_models([topic_model, topic_model1])
154154

155-
assert len(merged_model.get_topic_info()) > len(topic_model1.get_topic_info())
156155
assert len(merged_model.get_topic_info()) > len(topic_model.get_topic_info())

0 commit comments

Comments
 (0)