猫史档案馆


【Python作品分享】词云案例1gg【作品秀】

用户:gyquinegyquine查看:40 回复:0 评论:0 创建时间:2020-02-18T15:30:32


【作品展示】

center_image

 

【作品介绍】

ku 1

 

【作品源代码】

import wordcloud


"""
作者:
功能:默认参数下的词云
描述:为一个英文短句按照词频生成一个词云
版本:1.0
日期:02/17/2020
"""
# 导入词云制作第三方库wordcloud
import wordcloud
# 引入词云对象,赋值给w,现在w就表示了一个词云对象
w = wordcloud.WordCloud()
# 调用词云对象的generate方法,将文本传入
w.generate("You were meant to be different. Nowhere, in all of history, will the same things be going on in anyone’s mind, soul and spirit as are going on in yours right now.")# 将生成的词云保存为output1.png图片文件,保存出到当前文件夹中
w.to_file("1.png")

 

【提示】

部分含有Python第三方库相关内容的作品,在海龟编辑器网页端无法运行哦!如遇到这种情况,可以打开下面的链接,下载海龟编辑器客户端:

https://python.codemao.cn


回复

上一页第 1 页 / 共 0 页下一页