<jupyter_start><jupyter_text>Dependencies<jupyter_code>import os
import re
from datetime import datetime<jupyter_output><empty_output><jupyter_text>Get posts list<jupyter_code>Folder_list = ['../Dessert','../Main_Course']
Post_list = []
for folder in Folder_list:
    for root, directories, files in os.walk(folder, topdown=False):
        for name in files:
            print(os.path.join(root, name))
            if '.md' in name:
                Post_list.append(os.path.join(root, name))
Post_list<jupyter_output><empty_output><jupyter_text>Update reading time<jupyter_code>for post in Post_list:
    f = open(post, 'r')
    htmlmarkdown="".join(f.readlines())
    match = re.search(r'\d{4}-\d{2}-\d{2}', post.split('/')[-1])
    date = datetime.strptime(match.group(), '%Y-%m-%d').date()
    htmlmarkdown = re.sub(r"发布于\d+-\d+-\d+，阅读时间", "发布于{}，阅读时间".format(date), htmlmarkdown)
    chinese_word = re.findall(r'[\u4E00-\u9FFF]',htmlmarkdown)
    print(len(chinese_word))
    htmlmarkdown = re.sub(r"阅读时间：约\d+分钟", "阅读时间：约{}分钟".format(int(len(chinese_word)/200)), htmlmarkdown)
    
    with open(post, 'w') as new_file:    
        new_file.write(htmlmarkdown)<jupyter_output>2465
2179
3119
1916
962
1224
749
862
1164
1280
1093
2537
{'fraction_non_alphanumeric': 0.16585760517799353, 'fraction_numerical': 0.045307443365695796, 'mean_word_length': 4.197478991596639, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 12, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '94823', 'license': 'MIT', 'n_tokens_mistral': 525, 'n_tokens_neox': 503, 'n_words': 79, 'path': 'docs/Scripts/Update_reading_time.ipynb', 'repo_name': 'dragond041/BulletTech', 'size': '1236'}