Word Cloud正确识别@用户名 #367

This commit is contained in:
Yucheng Huo 2024-04-26 19:12:43 -04:00
parent 326ca1f873
commit 45dbc58cd4

View File

@ -1,4 +1,5 @@
import os
import re
from collections import Counter
import sys
from datetime import datetime
@ -28,6 +29,7 @@ def wordcloud_(wxid, time_range=None):
}
# text = ''.join(map(lambda x: x[7], txt_messages))
text = ''.join(map(lambda x: x[7], txt_messages)) # 1“我”说的话0“Ta”说的话
text = re.sub(r'^@\w+\s', '', text) # 去掉@的人
total_msg_len = len(text)
# 使用jieba进行分词并加入停用词