From db995c146a311888ac2c8dee8cc865b177455828 Mon Sep 17 00:00:00 2001 From: Lars O Grobe <38878584+larsgrobe@users.noreply.github.com> Date: Fri, 5 Jan 2024 14:24:36 +0300 Subject: [PATCH] Pass num_topics to LdaModel Pass the num_topics parameter to LdaModel with gensim4. --- litstudy/nlp.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/litstudy/nlp.py b/litstudy/nlp.py index a4fc0c5..48f8a30 100644 --- a/litstudy/nlp.py +++ b/litstudy/nlp.py @@ -326,7 +326,7 @@ def train_lda_model(corpus: Corpus, num_topics, seed=0, **kwargs) -> TopicModel: model = LdaModel(list(corpus), **kwargs) elif gensim_mayor == 4: from gensim.models.ldamodel import LdaModel - model = LdaModel(freqs, id2word=dic, **kwargs) + model = LdaModel(freqs, id2word=dic, num_topics=num_topics, **kwargs) else: from sys import exit exit('LdaModel could not be imported from gensim 3 or 4.')