import re


# 针对文件名进行数据清洗
def clean_file_names(filename: str):
    """
    针对文件名进行数据清洗
    :param filename:
    :return:
    """
    # 移除所有非字母、数字、点和下划线的字符
    cleaned = re.sub(r"[^\w.-]|[\s\r\n]*", "", filename)
    # 确保文件名不为空
    if not cleaned:
        cleaned = "untitled"
    return cleaned
