diff --git a/bertopic/_bertopic.py b/bertopic/_bertopic.py index 0c732338..82c4a74a 100644 --- a/bertopic/_bertopic.py +++ b/bertopic/_bertopic.py @@ -4489,11 +4489,11 @@ def _auto_reduce_topics(self, documents: pd.DataFrame, use_ctfidf: bool = False) for key, val in sorted(mapped_topics.items()): mappings[val].append(key) mappings = { - topic_from: { - "topics_to": topics_to, - "topic_sizes": [self.topic_sizes_[topic] for topic in topics_to], + topic_to: { + "topics_from": topics_from, + "topic_sizes": [self.topic_sizes_[topic] for topic in topics_from], } - for topic_from, topics_to in mappings.items() + for topic_to, topics_from in mappings.items() } # Update documents and topics