三年前写的文章,阅读量暴涨了6.8万。。。

简介: 三年前写的文章,阅读量暴涨了6.8万。。。

这里统计了互发消息条数前十名的好友,出于隐私就不放名字了。

可以看出几点信息:

  • 常聊天的好友主要有3位,再后面的就出现断崖式下降了。
  • 今年我回复的消息远远不及接收的消息多,对比前两年,我是回复大于接收的。(难道说今年我变高冷了?)
  • 相比前两年,前三名是新面孔,很多之前的老面孔都退出了前10名,工作了之后确实聊的少了。
  • 好友6的回复条数尤其少,大概接收10条才回复1条,在我粉丝群的老粉应该都能猜出这是谁。

一年中聊天数量趋势

从2022.1.1开始统计到2022.11.11为止,我画出了每一天私聊互发消息条数的趋势图。

这张图有很大的信息量:

  • 年初到过年期间(0-60天)越聊越多,可能过年在家无聊吧。
  • 上海封城期间(60-140天)越聊越少,封城后期天天打游戏,都快自闭了吧可能。
  • 5月底(140天)开始,消息量急速上升,因为遇见了一个改变了我许多的人。
  • 678三个月(140-230天),消息量急速下降直到正常,毕竟不可能一直维持刚开始的热情的,那不得累死。
  • 9月份(230-270天),消息量又上升了一点,可能是因为要回了吧。
  • 10月份(270-300天),消息量降到全年最低,因为不需要网聊了吧。
  • 再往后又上升至正常,因为又回到上半年的状态了吧。

这里不深入分析了,等一个月后的年终总结吧。不管怎么样,感谢吧。

一天中几点聊的最多?

这个趋势和前两年是一样的,我仍然是一个夜猫子。夜越深,聊的越嗨,半夜12点是我聊的最嗨的时候。而中午和下午是聊的最少的时候,因为要上班。

我最喜欢发什么词?

可以看出发的最多的词是:肯定、确实、哦哦哦、喜欢、感觉。

实现方法

首先你得有一个mac电脑,然后用下面方法导出聊天记录,并且都存放在jsons目录下:

超简单:mac导出微信聊天记录(附上粉丝群全部聊天记录)

然后用下面的代码导出你所有的私聊记录,保存到output.txt文件中。

import json
import os
files = os.listdir("jsons")
fout = open("output.txt", "w")
for f in files:
    with open(f"jsons/{f}", "r") as fin:
        print(f)
        results = json.load(fin)
        is_group = 1
        for dic in results:
            if (
                dic["messageType"] == 1
                and dic["msgCreateTime"] >= 1640966434
                and dic["msgStatus"] != 2
                and dic["mesDes"] == 1
                and ":" not in dic["msgContent"]
            ):
                is_group = 0
                break
        if not is_group:
            for dic in results:
                if (
                    dic["messageType"] == 1
                    and ":" not in dic["msgContent"]
                    and dic["msgCreateTime"] >= 1640966434
                    and dic["msgStatus"] != 2
                ):
                    content = "".join(dic["msgContent"].strip().split())
                    if dic["mesDes"] == 1:
                        fout.write(
                            "{} 1 {} {}\n".format(f, str(dic["msgCreateTime"]), content)
                        )
                    else:
                        fout.write(
                            "{} 0 {} {}\n".format(f, str(dic["msgCreateTime"]), content)
                        )
fout.close()

最后用下面代码分析本文中提到的几点要素,注意改一下中文字体路径。最后还会生成me.txt,可以用来生成词云,生成方法参考之前的文章。

python生成词云教程(附带QQ聊天记录生成词云实战)

import datetime
from collections import defaultdict
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
from matplotlib.font_manager import FontProperties
import matplotlib.font_manager
def getChineseFont():
    # 去你电脑的字体库找一个中文字体,把文件路径粘贴过来
    return FontProperties(fname="/System/Library/Fonts/PingFang.ttc", size=20)
matplotlib.rcParams["pdf.fonttype"] = 42
matplotlib.rcParams["ps.fonttype"] = 42
# 2022.1.1 00:00
start = 1640966434
def process_time(end):
    t = datetime.datetime(2022, 1, 1, 0, 0, 0) + datetime.timedelta(seconds=end - start)
    return (t.month, t.day, t.hour, t.minute, t.second)
"""跟谁聊的最多
姓名 总共 发送 接收
"""
name_count = defaultdict(int)
send_count = defaultdict(int)
rece_count = defaultdict(int)
with open("output.txt", "r") as fin:
    for line in fin:
        name = line.strip().split(" ")[0]
        des = int(line.strip().split(" ")[1])
        name_count[name] += 1
        if des == 0:
            send_count[name] += 1
        else:
            rece_count[name] += 1
nc = sorted(name_count.items(), key=lambda x: x[1], reverse=True)
for k in nc[:10]:
    print(k[0], k[1], send_count[k[0]], rece_count[k[0]])
c1 = [x[1] for x in nc[:10]]
c2 = [send_count[x[0]] for x in nc[:10]]
c3 = [rece_count[x[0]] for x in nc[:10]]
r = np.arange(len(c1))
plt.figure(figsize=(8, 6))
plt.plot(r, c1, color="red", label="Total", linewidth=2.0)
plt.plot(r, c2, color="green", label="Send", linewidth=2.0)
plt.plot(r, c3, color="blue", label="Receive", linewidth=2.0)
plt.yticks(fontsize=20)
plt.xlabel("姓名", fontproperties=getChineseFont(), fontsize=20)
plt.ylabel("消息条数", fontproperties=getChineseFont(), fontsize=20)
plt.legend(fontsize=20)
plt.savefig("./name_count.pdf", bbox_inches="tight")
plt.show()
"""哪个月份聊的最多
月份 数量
"""
month_count = defaultdict(int)
with open("output.txt", "r") as fin:
    for line in fin:
        time = int(line.strip().split(" ")[2])
        t = process_time(time)
        month_count[t[0]] += 1
mc = sorted(month_count.items(), key=lambda x: x[1], reverse=True)
for k in mc:
    print(k[0], k[1])
mc = sorted(month_count.items(), key=lambda x: x[0], reverse=False)
x_ticks = [x[0] for x in mc]
c = [x[1] for x in mc]
r = np.arange(len(c))
plt.figure(figsize=(8, 6))
plt.plot(r, c, color="red", linewidth=2.0)
plt.xticks([r for r in range(len(c))], x_ticks, fontsize=20)
plt.yticks(fontsize=20)
plt.xlabel("月份", fontproperties=getChineseFont(), fontsize=20)
plt.ylabel("消息条数", fontproperties=getChineseFont(), fontsize=20)
plt.legend(fontsize=20)
plt.savefig("./month_count.pdf", bbox_inches="tight")
plt.show()
"""哪个时间点聊的最多
几点 数量
"""
hour_count = defaultdict(int)
with open("output.txt", "r") as fin:
    for line in fin:
        time = int(line.strip().split(" ")[2])
        t = process_time(time)
        hour_count[t[2]] += 1
hc = sorted(hour_count.items(), key=lambda x: x[1], reverse=True)
for k in hc:
    print(k[0], k[1])
hc = sorted(hour_count.items(), key=lambda x: x[0], reverse=False)
x_ticks = [x[0] for x in hc]
c = [x[1] for x in hc]
r = np.arange(len(c))
plt.figure(figsize=(14, 6))
plt.plot(r, c, color="red", linewidth=2.0)
plt.xticks([r for r in range(len(c))], x_ticks, fontsize=20)
plt.yticks(fontsize=20)
plt.xlabel("小时", fontproperties=getChineseFont(), fontsize=20)
plt.ylabel("消息条数", fontproperties=getChineseFont(), fontsize=20)
plt.legend(fontsize=20)
plt.savefig("./hour_count.pdf", bbox_inches="tight")
plt.show()
"""哪一天聊的最多
"""
day_count = defaultdict(int)
with open("output.txt", "r") as fin:
    for line in fin:
        time = int(line.strip().split(" ")[2])
        t = process_time(time)
        day_count[t[0] * 31 + t[1]] += 1
dc = sorted(day_count.items(), key=lambda x: x[0], reverse=False)
c = [x[1] for x in dc]
r = np.arange(len(c))
plt.figure(figsize=(14, 6))
plt.plot(r, c, color="red", linewidth=2.0)
plt.yticks(fontsize=20)
plt.xlabel("第几天", fontproperties=getChineseFont(), fontsize=20)
plt.ylabel("消息条数", fontproperties=getChineseFont(), fontsize=20)
plt.legend(fontsize=20)
plt.savefig("./day_count.pdf", bbox_inches="tight")
plt.show()
"""我最喜欢发什么词?
"""
with open("output.txt", "r", encoding="utf-8") as fin, open("me.txt", "w", encoding="utf-8") as fout:
    for line in fin:
        des = int(line.strip().split(" ")[1])
        if des == 0:
            content = line.strip().split(" ")[3]
            fout.write(content + "\n")
相关文章
|
存储 自然语言处理 数据可视化
可视化FAISS矢量空间并调整RAG参数提高结果精度
随着开源大型语言模型的性能不断提高,编写和分析代码、推荐、文本摘要和问答(QA)对的性能都有了很大的提高。但是当涉及到QA时,LLM通常会在未训练数据的相关的问题上有所欠缺,很多内部文件都保存在公司内部,以确保合规性、商业秘密或隐私。当查询这些文件时,会使得LLM产生幻觉,产生不相关、捏造或不一致的内容。
437 0
|
SQL 存储 安全
Spring Boot集成Mybatis-Plus多租户架构实战
Spring Boot集成Mybatis-Plus多租户架构实战
1124 0
Spring Boot集成Mybatis-Plus多租户架构实战
|
7月前
|
机器学习/深度学习 人工智能 搜索推荐
《深度剖析:鸿蒙系统下智能NPC与游戏剧情的深度融合》
鸿蒙系统为游戏开发带来新机遇,尤其在人工智能游戏中,实现智能NPC与剧情的深度融合成为关键。通过机器学习行为模型和感知决策系统,NPC能根据玩家操作做出合理反应;结合动态剧情生成和数据驱动融合方式,使游戏体验更沉浸、个性化。尽管面临技术挑战,但鸿蒙系统的多设备协同和性能优势,为打造未来智能化游戏奠定了基础。
270 11
|
NoSQL API Redis
最佳实践|如何使用c++开发redis module
本文将试着总结Tair用c++开发redis module中遇到的一些问题并沉淀为最佳实践,希望对redis module的使用者和开发者带来一些帮助(部分最佳实践也适用于c和其他语言)。
76880 0
|
12月前
|
API 开发者
提供一份 1688 商品详情接口的错误码及解决方法
本文介绍了 1688 商品详情接口常见的错误码及其解决方法,包括 401(未授权)、403(禁止访问)、404(未找到)、429(请求过多)和 500/502/504(服务器错误)。详细说明了每个错误码的含义及相应的解决步骤,帮助开发者快速定位并解决问题。
|
Shell 网络安全 开发工具
git与gitee结合使用,提交代码,文件到远程仓库
本文介绍了如何将Git与Gitee结合使用来提交代码文件到远程仓库。内容涵盖了Git的安装和环境变量配置、SSH公钥的生成和配置、在Gitee上创建仓库、设置Git的全局用户信息、初始化本地仓库、添加远程仓库地址、提交文件和推送到远程仓库的步骤。此外,还提供了如何克隆远程仓库到本地的命令。
git与gitee结合使用,提交代码,文件到远程仓库
|
存储 Kubernetes 负载均衡
k8s 数据流向 与 核心概念详细介绍
k8s 数据流向 与 核心概念详细介绍
|
NoSQL Redis 数据库
Redis内核基于时间点的备份恢复和基于AOF日志的增量同步机制设计
11月30日云栖社区在线培训,阿里云资深开发工程师夏德军为大家带来阿里云Redis内核优化的分享。本文从两大方面介绍阿里云Redis服务,一是Redis内核支持基于时间点的备份恢复,一是Redis基于AOF日志的增量同步机制设计,并分别通过假设场景,详细的分析了备份恢复流程和AOF PSYNC流程。
10380 1
|
机器学习/深度学习 人工智能 算法
人工智能:通俗易懂理解深度学习与神经网络
人工智能:通俗易懂理解深度学习与神经网络
2385 0
人工智能:通俗易懂理解深度学习与神经网络
|
存储 机器学习/深度学习 并行计算
cuBLAS矩阵乘法性能分析(附代码示例)
cuBLAS矩阵乘法性能分析(附代码示例)
550 0