Error implementing gensim.LdaMallet

I followed the instructions at this link (" http://radimrehurek.com/2014/03/tutorial-on-mallet-in-python/ "), however I encountered an error when I tried to train the model:

    model = models.LdaMallet(mallet_path, corpus, num_topics =10, id2word = corpus.dictionary)
    IOError: [Errno 2] No such file or directory: 'c:\\users\\brlu\\appdata\\local\\temp\\c6a13a_state.mallet.gz'

Please share your thoughts.

Thank.

+4
source share
4 answers

This can happen for two reasons: 1. You have a place in the path of your hammer. 2. There is no environment variable MALLET_HOME.

+3
source
  • Make sure the file is running from the command line .
  • "c:\users\brlu\appdata\local\temp \...", , , . .
0

  • import tempfile
  • < > tempfile.tempdir = 'some_other_non_system_temp_directory'
-1

gensim + MALLET Windows:

  • , MALLET_HOME
  • mallet_path Python

    mallet_path = 'c:\\mallet-2.0.7\\bin\\mallet'
    LDA_model = gensim.models.LdaMallet(mallet_path, ...
    
  • , 142 Python\Lib\site-packages\gensim\models\ldamallet.py: change --token-regex '\S+' --token-regex \"\S+\"

,

-1

Source: https://habr.com/ru/post/1543898/


All Articles