diff --git a/count.py b/count.py new file mode 100644 index 0000000..fa99851 --- /dev/null +++ b/count.py @@ -0,0 +1,43 @@ +import os +import re +from collections import Counter +import pandas as pd + + + + + + + +def read_danmu_files(directory): + danmu_data = [] + for filename in os.listdir(directory): + if filename.endswith('paris_olympics_danmak.txt'): + with open(os.path.join(directory, filename), 'r', encoding='utf-8') as file: + danmu_data.extend(file.readlines()) + return danmu_data + +def count_danmu(): + danmu_data = read_danmu_files('./') # 当前目录下 + + ai_danmaku = [danmaku for danmaku in danmu_data if + re.search(r'(?