专名本土化(信达雅):冻结译名表 + 渲染层,并修掉校验器的正则盲点

- 新增 dfannals/glossary.py(译名表)与 dfannals/localize.py(渲染层)
  人名=音译+绰号意译(Ral Fastenhatchets→拉尔·缚斧、朗古德·商熊「剖胎之寒」),
  地名整体意译(Fordedwinds→涉风渡、The Volcano Of Ravens→渡鸦火山)
- 生成链路本土化:素材渲染、人物表、扩写白名单全部走译名;已有产物做确定性替换
- 修复 factcheck 的 \b 盲点:Unicode 下汉字也算词字符,紧贴汉字的英文名不被检查
  (曾因此漏掉编造专名)。修好后抓出并定点修掉长版第 1 集的 2 处编造
- 修正 title_form 大小写(YETI→Yeti),此前 Yeti/Goblin 一直漏译
- 新增 tests/test_localize.py(13 项回归)
This commit is contained in:
Chen Yi
2026-10-05 22:39:53 +08:00
parent 8630dcad55
commit 16b476167e
14 changed files with 924 additions and 350 deletions
+3 -2
View File
@@ -15,7 +15,7 @@ import re
from dataclasses import dataclass
from pathlib import Path
from dfannals import factcheck
from dfannals import factcheck, localize
from dfannals.config import MAX_TOKENS_STRUCTURED, Gateway
from dfannals.episodes import Episode
from dfannals.legends import Event, World
@@ -221,7 +221,8 @@ def build_cast(
"",
]
return "\n".join(lines) + "\n", rows, suspicions
# 专名本土化:表格与小传都输出中文译名
return localize.for_world(world).render("\n".join(lines)) + "\n", rows, suspicions
def write_cast(path: Path, text: str) -> Path: