文笔层:AI 味机检、标点规范化、分块大量扩写(第 1 集成稿 10805 字)
- 修复上次提交把 dfannals/cli.py 写成 0 字节的问题(它是唯一入口,导致管道不可运行) - 性别:解析 <caste>,人物表与写作素材带性别(Ral Fastenhatchets 实为女性) - 新增 dfannals/deslop.py:AI 味机械诊断(硬伤词/句式/标点,按千字密度报告) - 新增 dfannals/normalize.py:标点与结构清理(引号配对、重复段落与句子、模型自加的小节标记) - 新增 dfannals/expand.py 与 prompts/literary-expander.md:按年份场景分块大量扩写 - 专名防幻觉:每块附史料专名白名单,事后按段自动修复可疑专名 - episode 命令并进文笔层(骨架稿另存 .skeleton.md),新增 expand 命令做 A/B 对照 - 新增 notes/switched-threads.md 与 test_deslop / test_normalize 回归测试 - 提交前拦截「已跟踪文件为空」,防止上述事故复发
This commit is contained in:
@@ -45,12 +45,23 @@ class Figure:
|
||||
name: str = ""
|
||||
race: str = ""
|
||||
sex: int | None = None
|
||||
caste: str = "" # 史料里的性别字段(v53 导出用 <caste>MALE/FEMALE</caste>)
|
||||
birth_year: int | None = None
|
||||
death_year: int | None = None
|
||||
profession: str = ""
|
||||
entities: list[int] = field(default_factory=list)
|
||||
sites: list[int] = field(default_factory=list)
|
||||
|
||||
@property
|
||||
def gender(self) -> str:
|
||||
"""史料记载的性别,用于避免正文里默认称呼"他"。"""
|
||||
c = (self.caste or "").upper()
|
||||
if c == "FEMALE":
|
||||
return "女"
|
||||
if c == "MALE":
|
||||
return "男"
|
||||
return ""
|
||||
|
||||
@property
|
||||
def alive_span(self) -> str:
|
||||
# DF 用负数占位表示“无此项”(未记录/未死),不要当成真实年份显示
|
||||
@@ -333,6 +344,7 @@ def _add_figure(world: World, elem) -> None:
|
||||
fig = world.figures.setdefault(fid, Figure(id=fid))
|
||||
fig.name = fig.name or _first(d, "name")
|
||||
fig.race = fig.race or _first(d, "race")
|
||||
fig.caste = fig.caste or _first(d, "caste")
|
||||
fig.profession = fig.profession or _first(d, "profession")
|
||||
if fig.sex is None:
|
||||
fig.sex = _int_or_none(_first(d, "sex"))
|
||||
|
||||
Reference in New Issue
Block a user