The title pretty much says it all. Here's some test code:
import os
os.environ.update({'MALLET_HOME': r'C:/Users/somebody/a/place/LDA/mallet-2.0.8/',
'JAVA_HOME': r'C:/Program Files/Java/jdk1.8.0_131/'})
from gensim.corpora import mmcorpus, Dictionary
texts = [['human', 'interface', 'computer'],
['survey', 'user', 'computer', 'system', 'response', 'time'],
['eps', 'user', 'interface', 'system'],
['system', 'human', 'system', 'eps'],
['user', 'response', 'time'],
['trees'],
['graph', 'trees'],
['graph', 'minors', 'trees'],
['graph', 'minors', 'survey']]
dictionary = Dictionary(texts)
corpus = [dictionary.doc2bow(text) for text in texts]
import gensim
mallet_path = r'C:\Users\somebody\a\place\LDA\mallet-2.0.\bin\mallet'
gensim.models.wrappers.LdaMallet(mallet_path, corpus=corpus, id2word=dictionary, num_topics=5, alpha=1)
This raises the following error (truncated, since most of it is irrelevant stack info):
CalledProcessError Traceback (most recent call last)
<ipython-input-99-7343c192afd1> in <module>()
5 mallet_path = r'C:\Users\somebody\a\place\LDA\mallet-2.0.8\bin\mallet'
----> 6 gensim.models.wrappers.LdaMallet(mallet_path, corpus=corpus, id2word=dictionary, num_topics=5, alpha=1)
.
.
.
CalledProcessError: Command 'C:\Users\somebody\a\place\LDA\mallet-2.0.8\bin\mallet import-file --preserve-case --keep-sequence --remove-stopwords --token-regex "\S+" --input C:\Users\somebody\AppData\Local\Temp\33b805_corpus.txt --output C:\Users\somebody\AppData\Local\Temp\33b805_corpus.mallet' returned non-zero exit status 1.
Fine, super, but when I go run that exact command in cmd.exe, or in cygwin, There is no error, the code runs just fine! I can even test the return code: "echo $?" in cygwin returns 0. Any help much appreciated!