CalledProcessError: Returned non-zero exit status 1

CalledProcessError: Returned non-zero exit status 1

当我尝试 运行:

def remove_stopwords(texts):
    return [[word for word in simple_preprocess(str(doc)) if word not in stop_words] for doc in texts]

def make_bigrams(texts):
    return [bigram_mod1[doc] for doc in texts]

# Remove Stop Words
data_words_nostops1 = remove_stopwords(data_words1)

# Form Bigrams
data_words_bigrams1 = make_bigrams(data_words_nostops1)    
# Create Dictionary
    id2word1 = corpora.Dictionary(data_words_bigrams1)

# Create Corpus
texts1 = data_words_bigrams1

# Term Document Frequency
corpus1 = [id2word1.doc2bow(text) for text in texts1]

mallet_path = 'T:Python/Mallet/mallet-2.0.8/bin/mallet'

ldamallet = gensim.models.wrappers.LdaMallet(mallet_path, corpus=corpus1, num_topics=15, id2word=id2word1)

我收到以下错误:

CalledProcessError: Command 'T:/Python/Mallet/mallet-2.0.8/bin/mallet import-file --preserve-case --keep-sequence --remove-stopwords --token-regex "\S+" --input C:\Users\E26E5~1.RIJ\AppData\Local\Temp\a66fc0_corpus.txt --output C:\Users\E26E5~1.RIJ\AppData\Local\Temp\a66fc0_corpus.mallet' returned non-zero exit status 1.

我可以在我的代码中做些什么来让它工作?

此外,这个错误的问题之前已经问过几次了。但是,每个答案似乎都针对特定情况,以至于我看不出我现在可以对我的代码进行哪些更改以使其正常工作。有人可以详细说明这个问题的含义吗?

确保你有:

  • Java 开发人员工具包已下载 JDK
  • Mallet 已解压Mallet

并将您的 env 放在正确的文件夹中,否则更新它,例如:

  • 进口os
  • os.environ.update({'MALLET_PATH':r'Python/Mallet/mallet-2.0.8/bin'})