【发布时间】:2019-11-19 00:25:18
【问题描述】:
目前,我有一个用于修改列表的嵌套 for 循环。我正在尝试在使用多处理时创建相同的输出。
我当前的代码是,
for test in test_data:
output.append([((ngram[-1], ngram[:-1],model.score(ngram[-1], ngram[:-1])) for ngram in
test])
其中 test_data 是生成器对象,model.score 来自 NLTK 包。
我找到并尝试过的所有解决方案都不起作用(至少在我的情况下)。
有没有办法通过多处理获得相同的输出?
【问题讨论】:
标签: python loops nlp nltk python-multiprocessing