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