- 将历史档案整体迁移至 `old/`,包含旧大纲、人物卡、世界书、参考资料与脚本 - 重写 `AGENTS.md` 为全书创作约束,去除剧情进度管理 - 重写 `世界书.md`,时间锚点由 1945 年 3 月改为 1945 年 4 月 26 日 - 重写 `伏笔与承诺.md` 与 `资产索引.md`,建立新旧设定权威顺序 - 重写宁诚、古米、赫默、铃兰、朱文晋五张人物卡;朱文晋改为带队指挥员而非被藏匿伤员 - 新增 `资料-1945年越南政治势力图谱.md` 作为历史写作资料层 - 重写 `项目总览.md`,明确五条长期叙事引擎与已确认边界 - 重写 1.1 五章正文:001《弃船》、002《事已至此,先吃饭吧》、003《蝗军来了》、004《狐火渺然》、005《越南救国军》;删除旧版 001—003 正文
30 lines
828 B
Python
30 lines
828 B
Python
#!/usr/bin/env python3
|
|
"""统计文本文件的中文字符数、总字符数、非空白字符数。"""
|
|
import argparse
|
|
import re
|
|
from pathlib import Path
|
|
|
|
|
|
def stats(text: str) -> dict:
|
|
return {
|
|
"chars": len(text),
|
|
"nonspace": len(re.sub(r"\s", "", text)),
|
|
"zh": len(re.findall(r"[\u4e00-\u9fff]", text)),
|
|
}
|
|
|
|
|
|
def main():
|
|
parser = argparse.ArgumentParser(description="Count Chinese characters in text files.")
|
|
parser.add_argument("paths", nargs="+", help="Files to count.")
|
|
args = parser.parse_args()
|
|
|
|
for path_str in args.paths:
|
|
path = Path(path_str)
|
|
text = path.read_text(encoding="utf-8")
|
|
s = stats(text)
|
|
print(f"{path}: 中文字符={s['zh']}, 总字符={s['chars']}, 非空白字符={s['nonspace']}")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|