Gensim mallet CalledProcessError: returned non-zero exit status

后端 未结 5 1623
忘掉有多难
忘掉有多难 2021-01-21 01:53

I\'m getting an error while trying to access gensims mallet in jupyter notebooks. I have the specified file \'mallet\' in the same folder as my notebook, but cant seem to acces

5条回答
  •  清歌不尽
    2021-01-21 02:39

    Make sure you installed the Java Developers Kit (JDK).

    The credit goes to this another answer

    After installing the JDK, the following codes for the LDA Mallet worked like charm!

    import os
    from gensim.models.wrappers import LdaMallet
    
    os.environ.update({'MALLET_HOME':r'C:/mallet/mallet-2.0.8/'})
    mallet_path = r'C:/mallet/mallet-2.0.8/bin/mallet.bat'
    
    lda_mallet = LdaMallet(
            mallet_path,
            corpus = corpus_bow,
            num_topics = n_topics,
            id2word = dct,
        )
    

提交回复
热议问题