Python——wordcloud
import jieba
from wordcloud import WordCloud,STOPWORDS
import matplotlib.pyplot as plt
from scipy.misc import imread back_ground = imread('F:/Python/PythonLeaning/测试专用文件夹/01300000165488121825589267854.png')
s1 = 'Time is short life; But even if the target clock speed along with life, ' \
'to one hour We end to this period of time was also engaged to spend too long. '
s2 = 'A prodigal son go with the sun is the general,' \
' but he was not the same as the solar cycle.'
mylist = [s1,s2]
word_list = [" ".join(jieba.cut(sentence)) for sentence in mylist]
new_text = ' '.join(word_list)
wordcloud = WordCloud(font_path='F:/Comic_Font.ttf',
background_color="white",
mask=back_ground,
).generate(new_text)
plt.imshow(wordcloud)
plt.axis("off")
plt.show()
wordcloud.to_file('test.png')
Python——wordcloud的更多相关文章
- python wordcloud
python wordcloud 对电影<我不是潘金莲>制作词云 上个星期五(16/11/18)去看了冯小刚的最新电影<我不是潘金莲>,电影很长,有点黑色幽默.看完之后我就去知 ...
- python wordcloud 对电影《我不是潘金莲》制作词云
上个星期五(16/11/18)去看了冯小刚的最新电影<我不是潘金莲>,电影很长,有点黑色幽默.看完之后我就去知乎,豆瓣电影等看看大家对于这部电影的评价.果然这是一部很有争议的电影,无论是在 ...
- 超详细:Python(wordcloud+jieba)生成中文词云图
# coding: utf-8 import jieba from scipy.misc import imread # 这是一个处理图像的函数 from wordcloud import WordC ...
- python WordCloud 实现词云
简单示例 from matplotlib import pyplot as plt from wordcloud import WordCloud filename = "text.txt& ...
- 根据词频生成词云(Python wordcloud实现)
网上大多数词云的代码都是基于原始文本生成,这里写一个根据词频生成词云的小例子,都是基于现成的函数. 另外有个在线制作词云的网站也很不错,推荐使用:WordArt 安装词云与画图包 pip3 insta ...
- python网页抓取练手代码
from urllib import request import html.parser class zhuaqu(html.parser.HTMLParser): blogHtml = " ...
- python 文件与数据格式化
https://www.cnblogs.com/li-zhi-qiang/p/9269453.html 文件和数据格式化 https://www.cnblogs.com/li-zhi-qi ...
- wordcloud+jieba
Wordcloud各参数含义 font_path : string #字体路径,需要展现什么字体就把该字体路径+后缀名写上,如:font_path = '黑体.ttf' width : int (de ...
- 【Python成长之路】词云图制作
[写在前面] 以前看到过一些大神制作的词云图 ,觉得效果很有意思.如果有朋友不了解词云图的效果,可以看下面的几张图(图片都是网上找到的): 网上找了找相关的软件,有些软件制作 还要付费.结果前几天在大 ...
随机推荐
- Android 将Android项目打包成aar文件
参考资料:https://blog.csdn.net/csdn_mm/article/details/78364444
- WEBGL学习【一】初识WEBGL
<html lang="zh-CN"> <head> <title>NeHe's WebGL</title> <meta ch ...
- 处理问题:windows server 2016由于没有远程桌面授权服务器可以提供许可证,远程会话被中断。请跟服务器管理员联系
windows server可以多用户同时登陆,默认最大远程登录数量为2,如果有更多人需要同时远程登录,则需要安装远程桌面授权服务,第一次安装后,免费期为120天,超过则无法正常远程登录. 解决办法如 ...
- nodejs-函数
使用表达式定义的函数要提到使用之前,要不然无法解析,自然的function xx(xx)不用,ECMAscript自动提前 with关键字 引入空间命令空间,然后可以直接使用里面的对象了 label标 ...
- c#基于udp实现的p2p语音聊天工具
原创性申明 此博文的出处 为 http://blog.csdn.net/zhujunxxxxx/article/details/40124773假设进行转载请注明出处.本文作者原创,邮箱zhujunx ...
- python的urlencode与urldecode
```python3.x中urlencode在urllib.parse模块中``` 当url地址含有中文,或者参数有中文的时候,这个算是很正常了,但是把这样的url作为参数传递的时候(最常见的call ...
- 沃通SSL精灵,让站点HTTPS永只是期
告别HTTP明文"裸奔"时代 百度.阿里巴巴.必应等越来越多的互联网巨头相继启用全站HTTPS加密,保护用户数据和隐私安全.逐步告别HTTP明文"裸奔"时代. ...
- ZooKeeper分布式集群部署及问题
ZooKeeper为分布式应用系统提供了高性能服务,在许多常见的集群服务中被广泛使用,最常见的当属HBase集群了,其他的还有Solr集群.Hadoop-2中的HA自己主动故障转移等. 本文主要介绍了 ...
- Spring-SpringJdbcTemlate配置介绍
使用spring的jdbcTemplate进一步操作JDBC 一.普通配置 SpringJdbcTemplate连接数据库并操作数据 1.applicationContext.xml 1.1 建立D ...
- Android自己定义RatingBar
注意rating_background图片做出来的图片最好和图片四周有一定的空隙.不然会造成图片底部被拉伸的情况. <RatingBar android:layout_width="w ...