Update web.py

词云分开统计:“我”说的最多和“TA”说的最多,而不是“我们”说的最多
This commit is contained in:
Xinghe 2023-12-13 19:24:05 +08:00 committed by GitHub
parent 3fe56a2bca
commit 219a66ccff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -34,15 +34,17 @@ def home():
return render_template('home.html', **data)
@app.route('/wordcloud')
def one():
@app.route('/wordcloud/<who>/')
def one(who):
wxid = contact.wxid
# wxid = 'wxid_lltzaezg38so22'
world_cloud_data = analysis.wordcloud(wxid)
# print('wxid:'+wxid)
world_cloud_data = analysis.wordcloud(wxid,who=who) # 获取与Ta的对话数据
# print(world_cloud_data)
who = "" if who == '1' else "TA"
with open('wordcloud.html', 'w', encoding='utf-8') as f:
f.write(render_template('wordcloud.html', **world_cloud_data))
return render_template('wordcloud.html', **world_cloud_data)
return render_template('wordcloud.html', **world_cloud_data,who=who)
def set_text(text):