0

to make topic modelling, I used this code, but BrokenPipeError: [Errno 32] Broken pipe error occurs. how to solve this problem.

from gensim.models import CoherenceModel
from multiprocessing import Process, freeze_support

coherence_score18=[]
def model_func(corpus18, id2word18, bigram_document18, a):
    for i in range(2,10):
        model18 = gensim.models.ldamodel.LdaModel(corpus=corpus18, id2word=id2word18, num_topics=i)
        coherence_model18=CoherenceModel(model18, texts=bigram_document18, dictionary=id2word18, coherence=a)
        coherence_lda18=coherence_model18.get_coherence()
        print('n=',i,'Score:',coherence_lda18)
        coherence_score18.append(coherence_lda18)
        

    if __name__ == '__main__':
        freeze_support()
An-nyeong
  • 3
  • 3

0 Answers0