lda可视化报错PicklingError: Can't pickle

问题遇到的现象和发生背景

pyldavis可视化运行结束后报错PicklingError: Can't pickle <joblib.externals.cloudpickle.cloudpickle._empty_cell_value object at 0x00000154CA689630>: it's not the same object as joblib.externals.cloudpickle.cloudpickle._empty_cell_value

问题相关代码,请勿粘贴截图

构建文本集

texts = [doc1]

词性标注条件

flags = ('n', 'nr', 'ns', 'nt', 'eng', 'v', 'd','vn','vd')

停用词表

stopwords = open('C:\Users\ASUS\Desktop\stop_words.txt',"r").read()

分词

words_ls = []
for text in texts:
# 采用jieba进行分词
words = [word.word for word in jp.cut(text) if word.flag in flags and word.word not in stopwords]
words_ls.append(words)

构造词典

dictionary = Dictionary(words_ls)

基于词典,使【词】→【稀疏向量】,并将向量放入列表,形成【稀疏向量集】

corpus = [dictionary.doc2bow(words) for words in words_ls]

lda模型,num_topics设置主题的个数

lda = LdaModel(corpus=corpus, id2word=dictionary, num_topics=5, random_state=100, iterations=50)

U_Mass Coherence

ldaCM = CoherenceModel(model=lda, corpus=corpus, dictionary=dictionary, coherence='u_mass')

打印所有主题,每个主题显示10个词

for topic in lda.print_topics(num_words=6):
print(topic)
data = pyLDAvis.gensim.prepare(lda,corpus,dictionary)

显示图形

pyLDAvis.show(data)

运行结果及报错内容

File "C:\Users\ASUS\Anaconda3\lib\pickle.py", line 927, in save_global
(obj, module_name, name))

PicklingError: Can't pickle <joblib.externals.cloudpickle.cloudpickle._empty_cell_value object at 0x00000154CA689630>: it's not the same object as joblib.externals.cloudpickle.cloudpickle._empty_cell_value

我的解答思路和尝试过的方法
我想要达到的结果

你好,我是有问必答小助手,非常抱歉,本次您提出的有问必答问题,技术专家团超时未为您做出解答


本次提问扣除的有问必答次数,将会以问答VIP体验卡(1次有问必答机会、商城购买实体图书享受95折优惠)的形式为您补发到账户。


因为有问必答VIP体验卡有效期仅有1天,您在需要使用的时候【私信】联系我,我会为您补发。