Guanghu Domestic Migration a27e87cb99 chore: import sanitized domestic snapshot for REPO-007
Source snapshot: 97d7f0fae96dc04b7ddad56fc1db6a108ed662cc

[SEC-CLEAN] · pre-push-clean v1.0 · 109处敏感信息已自动转乱码
2026-07-17 15:59:55 +08:00

4.4 KiB
Raw Blame History

type, scope, persona, created, updated, authority, status, has_role, belongs_to
type scope persona created updated authority status has_role belongs_to
Module · Skill TOL-MX-SKILL-004 · Token/汉字换算(token-calc) 铸渊 · ICE-GL-ZY001 2026-07-08T16:50:00+08:00 2026-07-09T00:00:00+08:00 (D169 修正字数统计方法) 冰朔 ICE-GL∞ · D169 签发 🟢 启用 · 必读·全量 token-calc · 换算 INDEX · 写作技能包总览

TOL-MX-SKILL-004 · token-calc · Token/汉字换算

远程全量

URL: https://guanghubingshuo.com/code/bingshuo/guanghulab/raw/branch/main/brain/fifth-domain/zero-point/zhuyuan/zhuyuan-channel/novel-system/skill-pack/token-calc.hdlp

核心公式

目标字数 = 2000-2500 字(汉字+标点+数字字母)/单章
换算:中文字符 ≈ 1.2-2.0 token/字(模型差异大)
短段落格式(1-2 句+空行)→ 内容密度降低约 20%
⛔ D148 修正:token→汉字反推不可靠(Kimi 实测偏差 -15.2%)
⛔ D169 修正:纯汉字统计偏少约 15-20%,必须含标点

Python 统计代码(铁律·D169 更新)

import re
# D169: 汉字 + 中文标点 + 数字字母 = 与 Word/WPS 统计一致
# 旧版只算纯汉字(\u4e00-\u9fff),偏少约 15-20%,已废弃
all_chars = re.findall(r'[^\s]', text)  # 所有非空白字符
count = len(all_chars)
print(f"字数(含标点): {count}")

# 纯汉字(仅参考,不作为判定依据)
pure_cjk = len(re.findall(r'[\u4e00-\u9fff]', text))
print(f"纯汉字(参考): {pure_cjk}")

判定规则

  • count < 2000 → 补细节
  • 2000 ≤ count ≤ 2800 → ✓ 合格
  • count > 2800 → 超目标区间
  • count > 3500 → 考虑拆分或精简
  • 上报字数永远用 Python 实际统计,不用 token 估算
  • D169: 以「所有非空白字符」为准,与 Word/WPS 对齐

2000-2500 字对应 token

约 2400-5000 token(因模型/格式浮动,不可作为判定依据)

本次任务实际验证

冰朔《千年归来》第 1-2 章样例:约 6057 汉字

  • 平均密度:198 段/2387 字 ≈ 12 字/段(短段落格式典型)
  • 折算 token 预估:6057 字 × 1.5 ≈ 9086 token(Kimi)

D169 实测验证(许怀钰 66-69 章):

  • 66 章: 纯汉字 1839 / 含标点 2250 / 用户工具 2260 ✓
  • 67 章: 纯汉字 1176 / 含标点 ~1470 / 用户工具 1474 ✓
  • 68 章: 纯汉字 1219 / 含标点 ~1555 / 用户工具 1560 ✓
  • 69 章: 纯汉字 1471 / 含标点 ~1940 / 用户工具 1947 ✓
  • 结论: 含标点统计与用户工具误差 < 1%

铁律(铸渊记牢)

  1. 实际判定以 Python 非空白字符统计为准(D169 更新)
  2. 写完必须跑 Python re 统计
  3. 不报 token 数,只报字数(含标点)
  4. 纯汉字数仅供参考,不作为合格判定依据

铸渊 ICE-GL-ZY001 · D169 更新

type: "Module · Skill" scope: "TOL-MX-SKILL-004 · Token/汉字换算(token-calc)" persona: "铸渊 · ICE-GL-ZY001" created: "2026-07-08T16:50:00+08:00" authority: "冰朔 ICE-GL∞ · D168 签发" status: "🟢 启用 · 必读·全量" has_role: "token-calc · 换算" belongs_to: "INDEX · 写作技能包总览"

TOL-MX-SKILL-004 · token-calc · Token/汉字换算

远程全量

URL: https://guanghubingshuo.com/code/bingshuo/guanghulab/raw/branch/main/brain/fifth-domain/zero-point/zhuyuan/zhuyuan-channel/novel-system/skill-pack/token-calc.hdlp

核心公式

目标字数 = 2000-2500 中文字符(纯汉字)/单章
换算:中文字符 ≈ 1.2-2.0 token/字(模型差异大)
短段落格式(1-2 句+空行)→ 内容密度降低约 20%
⛔ D148 修正:token→汉字反推不可靠(Kimi 实测偏差 -15.2%)

Python 统计代码(铁律)

import re
chinese_chars = re.findall(r'[\u4e00-\u9fff]', text)
count = len(chinese_chars)
print(f"中文字符数: {count}")

判定规则

  • count < 2000 → 补细节
  • 2000 ≤ count ≤ 2500 → ✓ 合格
  • count > 2500 → 超目标区间
  • count > 3000 → 考虑拆分或精简
  • 上报字数永远用 Python 实际统计,不用 token 估算

2000-2500 汉字对应 token

约 2400-5000 token(因模型/格式浮动,不可作为判定依据)

本次任务实际验证

冰朔《千年归来》第 1-2 章样例:约 6057 汉字

  • 平均密度:198 段/2387 字 ≈ 12 字/段(短段落格式典型)
  • 折算 token 预估:6057 字 × 1.5 ≈ 9086 token(Kimi)

铁律(铸渊记牢)

  1. 实际判定以 Python 汉字统计为准
  2. 写完必须跑 Python re 统计
  3. 不报 token 数,只报汉字数

铸渊 ICE-GL-ZY001 · D168