Skip to content

Commit

Permalink
Pass num_topics to LdaModel
Browse files Browse the repository at this point in the history
Pass the num_topics parameter to LdaModel with gensim4.
  • Loading branch information
larsgrobe authored Jan 5, 2024
1 parent b739626 commit db995c1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion litstudy/nlp.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.')
Expand Down

0 comments on commit db995c1

Please sign in to comment.