|
|
|
@ -87,7 +87,7 @@ def Gnerate_wordcloud(path)->None:
|
|
|
|
|
通过wordcloud库以及jieba将对应的文本文件生成词云
|
|
|
|
|
并且能够将所生成词云弹出
|
|
|
|
|
'''
|
|
|
|
|
mas = np.array(Image.open("D:\\pytest\\xt\\qs.png"))#读取背景图的信息
|
|
|
|
|
#mas = np.array(Image.open("D:\\pytest\\xt\\qs.png"))#读取背景图的信息
|
|
|
|
|
fp= open(path, 'r', encoding='utf-8')#获取文件指针
|
|
|
|
|
s=fp.read()#读取文件信息
|
|
|
|
|
fp.close()
|
|
|
|
@ -96,7 +96,7 @@ def Gnerate_wordcloud(path)->None:
|
|
|
|
|
w=wordcloud.WordCloud(font_path="msyhbd.ttc",
|
|
|
|
|
width=2000,
|
|
|
|
|
height=1700,
|
|
|
|
|
mask=mas,
|
|
|
|
|
#mask=mas,
|
|
|
|
|
background_color="white"
|
|
|
|
|
)#初始化
|
|
|
|
|
w.generate(tx)#生成词云
|
|
|
|
|