You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
510 B
29 lines
510 B
import requests
|
|
import re
|
|
import jieba
|
|
import wordcloud
|
|
import imageio
|
|
|
|
|
|
img = imageio.imread('a.png')
|
|
f = open('附加.txt', encoding='utf-8')
|
|
text = f.read()
|
|
print(text)
|
|
|
|
text_list = jieba.lcut(text)
|
|
print(text_list)
|
|
|
|
text_str = ' '.join(text_list)
|
|
print(text_str)
|
|
|
|
wc = wordcloud.WordCloud(
|
|
width = 500,
|
|
height = 500,
|
|
background_color = 'white',
|
|
mask = img,
|
|
# stopwords={'疑似',},
|
|
font_path = 'msyh.ttc'
|
|
)
|
|
wc.generate(text_str)
|
|
wc.to_file('词云.png')
|