Commit ae26453c by BellCodeEditor

save project

parent dfe51279
This diff is collapsed. Click to expand it.
{"code":0,"data":[],"success":true,"timestamp":1498654615930}
\ No newline at end of file
import wordcloud import wordcloud
from PIL import Image from PIL import Image
import numpy import numpy
import json
import jieba
with open('python二级考试大纲.txt',encoding="utf-8") as f: with open('python二级考试大纲.txt',encoding="utf-8") as f:
text=f.read() text=f.read()
a=jieba.lcut(text)
img=Image.open('duck.png') b=" ".join(a)
date=numpy.array(img) img=Image.open('bell.png')
imgcolor=wordcloud.ImageColorGenerator(date) data=numpy.array(img)
wordcloud.wordCloud(background_color="black",font_path="SimHef.ttf",mask=date) stopwords=["的","python","和","基本","程序"]
w.generate(text) imgcolor=wordcloud.ImageColorGenerator(data)
w.to_fill('wordcloud.png') w=wordcloud.WordCloud(background_color="black",font_path="SimHef.ttf",mask=data,color_func=imgcolor,stopwords=stopwords,max_font_size=60)
w.generate(b)
w.to_fill('wycloud.png')
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment