记录一下WordNet多线程下的bug

使用线程池的时候,WordNet会出现lazyrender的错误,通过查看一些资料,使用下面的方法去解决:

import nltk
from nltk.corpus import sentiwordnet as swn
# Do this first, that'll do something eval() 
# to "materialize" the LazyCorpusLoader
next(swn.all_senti_synsets()) 

# Your other code here. 

记录一下,这个问题查了很久。

参考

最佳解决方案地址

原文地址:https://www.cnblogs.com/future-dream/p/14728625.html