Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow chained main representation and aspects simultaneously #2021

Closed
wants to merge 1 commit into from
Closed
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
6 changes: 5 additions & 1 deletion bertopic/_bertopic.py
Original file line number Diff line number Diff line change
Expand Up @@ -4071,7 +4071,11 @@ def _extract_words_per_topic(self,
topics = self.representation_model.extract_topics(self, documents, c_tf_idf, topics)
elif isinstance(self.representation_model, dict):
if self.representation_model.get("Main"):
topics = self.representation_model["Main"].extract_topics(self, documents, c_tf_idf, topics)
if isinstance(self.representation_model["Main"], list):
for tuner in self.representation_model["Main"]:
topics = tuner.extract_topics(self, documents, c_tf_idf, topics)
else:
topics = self.representation_model["Main"].extract_topics(self, documents, c_tf_idf, topics)
topics = {label: values[:self.top_n_words] for label, values in topics.items()}

# Extract additional topic aspects
Expand Down