使用 python 将 one piece 的歌词生成路飞和乔巴

2016-01-11 11:59:03 +08:00
 flingjie

使用 jieba 和 wordcloud 将海贼王的歌词生成主角的样子. 放图
路飞:

乔巴:

https://github.com/flingjie/words_image
纯属娱乐,欢迎吐槽

4981 次点击
所在节点    分享创造
31 条回复
that5
2016-01-11 12:02:01 +08:00
好玩!
fengxiang
2016-01-11 12:17:29 +08:00
要是 v2 这种帖子能多点该多好,而不是首页上完厕所擦不擦弟弟。
fengxiang
2016-01-11 12:23:29 +08:00
这个颜色是怎么算的啊?蛮好看的
ethego
2016-01-11 12:31:08 +08:00
requirements 重新生成一下,少了 PIL 吧
adeweb
2016-01-11 12:36:15 +08:00
@fengxiang 噗~ 不能赞同更多。
adeweb
2016-01-11 12:36:58 +08:00
已 star ,很喜欢。
bk201
2016-01-11 12:44:45 +08:00
完全看不清原歌词了
flingjie
2016-01-11 12:49:48 +08:00
@fengxiang 颜色是用 wordcloud 中 ImageColorGenerator 自动从原图获取的
@ethego 已更新 requirements
kenis
2016-01-11 12:56:09 +08:00
@fengxiang 颜色应该是图片本身采样出的颜色

楼主的项目很好玩,赞
that5
2016-01-11 13:06:13 +08:00
@flingjie 我不懂程序,能否根据微博发言生成图片?估计更好玩
alexkh
2016-01-11 13:25:47 +08:00
有个文件命名错误: requirments.txt ,少了个 e ,应该是 requirements.txt
flingjie
2016-01-11 13:47:35 +08:00
@that5 可以根据微博生成, 回头试试
@alexkh 多谢指正
Strikeactor
2016-01-11 13:58:09 +08:00
感觉特别大的都是比较符合主题的关键词,这个是靠什么判断的,出现频率?
alexkh
2016-01-11 15:06:14 +08:00
试了下,经常提示 RuntimeError: Invalid DISPLAY variable 是什么原因?

在 Google 上查了下,添加了 matplotlib.use('Agg') 也无济于事。

@flingjie 没出现这种情况吗?
flingjie
2016-01-11 16:28:47 +08:00
@Strikeactor 是的, 频率越高字体越大
@alexkh 没遇到, 你是什么环境
kn007
2016-01-11 16:45:57 +08:00
超赞诶
alexkh
2016-01-11 16:59:21 +08:00
@flingjie 连的 VPS , Ubutu 14.04
klakekent
2016-01-11 17:01:20 +08:00
@fengxiang 是啊 V2EX 的水贴越来越多了 毫无营养
flingjie
2016-01-11 17:53:02 +08:00
@alexkh matplotlib.use('Agg') 需要写在 import pyplot 之前,
```
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
```
是按这个顺序写的吗?
alexkh
2016-01-11 17:59:14 +08:00
@flingjie 我试试,先谢了~

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/249834

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX