From dd19cb2fa0aac351f8e0553f1c68b7c531bac8ba Mon Sep 17 00:00:00 2001 From: sete39 Date: Wed, 7 Aug 2024 16:16:43 +0400 Subject: [PATCH] Changed to if/else instead of returning when checking if the c-TF-IDF matrix is None --- bertopic/_bertopic.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/bertopic/_bertopic.py b/bertopic/_bertopic.py index a8eb5000..388d5f05 100644 --- a/bertopic/_bertopic.py +++ b/bertopic/_bertopic.py @@ -3351,13 +3351,13 @@ def save( "The c-TF-IDF matrix could not be saved as it was not found. " "This typically occurs when merging BERTopic models with `BERTopic.merge_models`." ) - return - save_utils.save_ctfidf( - model=self, - save_directory=save_directory, - serialization=serialization, - ) - save_utils.save_ctfidf_config(model=self, path=save_directory / "ctfidf_config.json") + else: + save_utils.save_ctfidf( + model=self, + save_directory=save_directory, + serialization=serialization, + ) + save_utils.save_ctfidf_config(model=self, path=save_directory / "ctfidf_config.json") @classmethod def load(cls, path: str, embedding_model=None):