[go: nahoru, domu]

Skip to content

Commit

Permalink
Import sys.exit() to raise error if gensim not available
Browse files Browse the repository at this point in the history
This error-handling may not comply with the general litstudy convention.
  • Loading branch information
larsgrobe committed Jan 5, 2024
1 parent 98b7eb5 commit bcec9c0
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion litstudy/nlp.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,8 @@ def train_lda_model(corpus: Corpus, num_topics, seed=0, **kwargs) -> TopicModel:
from gensim.models.ldamodel import LdaModel
model = LdaModel(freqs, id2word=dic, **kwargs)
else:
sys.exit('LdaModel could not be imported from gensim 3 or 4.')
from sys import exit
exit('LdaModel could not be imported from gensim 3 or 4.')

doc2topic = corpus2dense(model[freqs], num_topics)
topic2token = model.get_topics()
Expand Down

0 comments on commit bcec9c0

Please sign in to comment.