From e2d32fa6d3f5374a4a931e35a057e527c104c037 Mon Sep 17 00:00:00 2001 From: phmycqkit <656078035@qq.com> Date: Wed, 18 Sep 2024 20:04:08 +0800 Subject: [PATCH] Delete 'GetAI.py' --- GetAI.py | 28 ---------------------------- 1 file changed, 28 deletions(-) delete mode 100644 GetAI.py diff --git a/GetAI.py b/GetAI.py deleted file mode 100644 index e94dcd4..0000000 --- a/GetAI.py +++ /dev/null @@ -1,28 +0,0 @@ -import pandas as pd -from collections import Counter - -def GetAI(): - # 读取弹幕文件 - with open('danmu.csv', 'r', encoding='utf-8-sig') as f: - danmus = f.readlines() - - # 筛选与AI技术应用相关的弹幕 - keywords = ['ai','Ai','AI'] - ai_danmu = [danmu for danmu in danmus if any(keyword in danmu for keyword in keywords)] - - # 统计弹幕数量 - ai_danmu_counter = Counter(ai_danmu) - ai_danmu_most_common = ai_danmu_counter.most_common(8) - ai_danmu_all = ai_danmu_counter.most_common(100) - - # 保存为Excel文件 - df = pd.DataFrame(ai_danmu_most_common, columns=['弹幕', '数量']) - filename = 'ai_danmu_most_common.xlsx' - df.to_excel(filename, index=False) - - df = pd.DataFrame(ai_danmu_all, columns=['弹幕', '数量']) - filename = 'ai_danmu.xlsx' - df.to_excel(filename, index=False) - -if __name__ == '__main__': - GetAI() \ No newline at end of file