From 0b2f31abaf4158872a8f36dd5cb7b4900acbb38c Mon Sep 17 00:00:00 2001 From: pw4izm9rs <2764851313@qq.com> Date: Wed, 18 Sep 2024 11:16:50 +0800 Subject: [PATCH] =?UTF-8?q?=E8=8E=B7=E5=8F=96AI=E6=8A=80=E6=9C=AF=E7=9B=B8?= =?UTF-8?q?=E5=85=B3=E5=BC=B9=E5=B9=95=E7=9A=84=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- get_AI.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 get_AI.py diff --git a/get_AI.py b/get_AI.py new file mode 100644 index 0000000..8bce92c --- /dev/null +++ b/get_AI.py @@ -0,0 +1,21 @@ +import pandas as pd +from collections import Counter + +# 读取弹幕文件 +with open('danmu.txt', 'r', encoding='utf-8') as f: + danmu_all = f.readlines() + +# 筛选包含关键词的弹幕 +keywords = ['人工智能','ai音效','ai视频','AI视频','AI音效','AI技术','ai技术','AI教练','AI训练','AI大模型','ai教练','ai训练','ai大模型', + 'AI解说','AI裁判','ai解说','ai裁判','云计算','AI设计','AI图','ai设计','ai图','AI作画','AI助手','ai还能帮运动员训练'] +ai_danmu = [danmu for danmu in danmu_all if any(keyword in danmu for keyword in keywords)] + +# 统计弹幕数量 +num = Counter(ai_danmu) +most_common = num.most_common(8) + +df = pd.DataFrame(most_common, columns=['弹幕内容', '数量']) + +# 保存为Excel文件 +excel_path = 'top8_danmu.xlsx' # 定义Excel文件的保存路径 +df.to_excel(excel_path, index=False) \ No newline at end of file