Skip to content

Commit 4c90c46

Browse files
committed
微信好友签名分析
1 parent 563aaef commit 4c90c46

33 files changed

Lines changed: 12851 additions & 3 deletions

PythonDemo/spider/alice_color.png

407 KB
Loading

PythonDemo/spider/itchat.pkl

-1.12 KB
Binary file not shown.

PythonDemo/spider/signatures.jpg

42.7 KB
Loading

PythonDemo/spider/signatures.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
打扰到 分心 自己前进 除了招妹 入群 大家 尽快 不要我能 尝试 别人 成功 只有简单 平和 宁静 快乐 轻松better me你好 明天欢乐 阳光几时遗憾 哪个 痛苦 努力幡动 风动 亦非 风吹 人心学到老 活到老主理 衣品 UNA 尤娜 天成15629323382 包容 宽容 号码 运用很久以前一喊 名字 还是哈哈哈 哈哈勇往直前 勇士 一样快乐奋斗 梦想宽容 怯懦 明白 选择 因为789296 拼搏 无能为力 感动 努力守信 敬业 爱家 诚实自寻烦恼 所有 问题 烦恼 只不过立即行动48 红包 头像 好友 添加快乐 重要慢慢 忽略 感觉 没有快乐 人生逆水 清羽 億佰 游鱼 迎风谢谢 如此猜猜 新品 神秘 什么咸鱼 做些 证明 总是 不是开心梦里 哪怕 曾经 至少 拥有勇敢 就要红尘 沾染 胭脂 青春 不解癞蛤蟆 天鹅 寂寞 没有半个 切图 CEO 前端 商人程序开发 微信 18071906679 13129808189 设限芳华 愿得 满树 韶华 刹那征程 星辰 大海全心全意 服务 人民享下 寻平处 处行 发上 高处若无真 不爱 寂寞 一生 不错一生 半途而废 怀抱 希望等待幸运 努力浴火重生 涅槃 凤凰大不一样 感受 理论 准备 不同fine独家 记忆 喜欢奇妙 人生等待 单纯 到来 习惯 以为一天勤之为 工成 于行车险 寿险 信用卡 团体 理财过时 永不 一首 努力玉汝于成 motivated man 才疏学浅 艰难困苦载雾 不吸 厚德 自强我要 低调 全世界 知道念念不忘 回响 必有QBQ 问题 背后身心 疲惫 三十 犹如work hard silence let success明月 几时 抬头 自己fighting青青俗人 入世 总有 一样 一些所有 填满 伤痛 呐喊 不是金天囯际 雪莲 充满活力 保养 生态苦短 放平 心有 快乐 心态平谈 平常心 生活拉群 小姐姐 bug 有时候 人工草莓 众生植草 愚笨 春生 荒地 田野脸皮厚 心黑 不含糊 做事永远都是 凋谢 春天 便是 意义春庭 犹见 离人照 落花 多情逆水 游鱼 迎风快乐 简单其折 之大 不知 世界心不动 不痛2764 钻石 金刚靜如 處子 動如脫hello world守信 敬业 爱家 诚实破坏性 吞食 苔藓 巨石 缓慢安之若素 冷暖自知 阳光

PythonDemo/spider/weixinQianming.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
@author: Administrator
66
"""
77
import re,jieba,itchat
8+
import jieba.analyse
89
import numpy as np
910
from PIL import Image
1011
from snownlp import SnowNLP
@@ -29,16 +30,16 @@ def analyseSignature(friends):
2930
file.write(signatures)
3031

3132
# Sinature WordCloud
32-
back_coloring = np.array(Image.open('flower.jpg'))
33+
back_coloring = np.array(Image.open('alice_color.png'))
3334
wordcloud = WordCloud(
3435
font_path='simfang.ttf',
3536
background_color="white",
3637
max_words=1200,
3738
mask=back_coloring,
3839
max_font_size=75,
3940
random_state=45,
40-
width=960,
41-
height=720,
41+
width=1250,
42+
height=1000,
4243
margin=15
4344
)
4445

PythonDemo/wordcloud/constitution.txt

Lines changed: 231 additions & 0 deletions
Large diffs are not rendered by default.

PythonDemo/wordcloud/examples/README.txt

Whitespace-only changes.
266 KB
Loading
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
#!/usr/bin/env python
2+
"""
3+
Using custom colors
4+
===================
5+
6+
Using the recolor method and custom coloring functions.
7+
"""
8+
9+
import numpy as np
10+
from PIL import Image
11+
from os import path
12+
import matplotlib.pyplot as plt
13+
import random
14+
15+
from wordcloud import WordCloud, STOPWORDS
16+
17+
18+
def grey_color_func(word, font_size, position, orientation, random_state=None,
19+
**kwargs):
20+
return "hsl(0, 0%%, %d%%)" % random.randint(60, 100)
21+
22+
d = path.dirname(__file__)
23+
24+
# read the mask image
25+
# taken from
26+
# http://www.stencilry.org/stencils/movies/star%20wars/storm-trooper.gif
27+
mask = np.array(Image.open(path.join(d, "stormtrooper_mask.png")))
28+
29+
# movie script of "a new hope"
30+
# http://www.imsdb.com/scripts/Star-Wars-A-New-Hope.html
31+
# May the lawyers deem this fair use.
32+
text = open(path.join(d, 'a_new_hope.txt')).read()
33+
34+
# preprocessing the text a little bit
35+
text = text.replace("HAN", "Han")
36+
text = text.replace("LUKE'S", "Luke")
37+
38+
# adding movie script specific stopwords
39+
stopwords = set(STOPWORDS)
40+
stopwords.add("int")
41+
stopwords.add("ext")
42+
43+
wc = WordCloud(max_words=1000, mask=mask, stopwords=stopwords, margin=10,
44+
random_state=1).generate(text)
45+
# store default colored image
46+
default_colors = wc.to_array()
47+
plt.title("Custom colors")
48+
plt.imshow(wc.recolor(color_func=grey_color_func, random_state=3),
49+
interpolation="bilinear")
50+
wc.to_file("a_new_hope.png")
51+
plt.axis("off")
52+
plt.figure()
53+
plt.title("Default colors")
54+
plt.imshow(default_colors, interpolation="bilinear")
55+
plt.axis("off")
56+
plt.show()

0 commit comments

Comments
 (0)