Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
d502498
Print corpus caveats beside the aggregate figures
jserv Nov 11, 2026
4f36ccf
Use one Han character predicate everywhere
jserv Nov 11, 2026
ba1e7dd
Keep numeric rewrite goals out of agent text
jserv Nov 11, 2026
bf9063f
Add trap fixtures for silent native prose
jserv Nov 11, 2026
9a64676
Treat JSON files as string values only
jserv Nov 11, 2026
7704324
Audit OpenCC residuals, flag merge-char misuse
jserv Nov 11, 2026
167d3cc
Run translationese and rhythm in the native corpus
jserv Nov 11, 2026
1a19953
Flag more AI-style openers and tells
jserv Nov 11, 2026
9cd513a
Stop ZY5 flagging a copula between possessives
jserv Nov 11, 2026
e1ab410
Flag bursts of short sentences as rhythm drama
jserv Nov 11, 2026
65dba13
Flag rhetorical tells and gate chatbot openers
jserv Nov 11, 2026
51ec17f
Add pinned external corpus benchmark
jserv Nov 11, 2026
0b57ab6
Add a register gate to rules for officialese
jserv Nov 11, 2026
75ebb58
Gate AI tells against native prose
jserv Nov 11, 2026
bf7f389
Gate the fixer on a per-position keep rate
jserv Nov 11, 2026
7aaa46a
Spare study closers and reported formal notices
jserv Nov 11, 2026
d2622e2
Gate spelling rules by register before matching
jserv Nov 11, 2026
a8a21e7
Read AI-style cues from the blanked view
jserv Nov 11, 2026
3091e50
Count hedging length on the author's text
jserv Nov 11, 2026
f807cd4
Count each inserted character in the shared diff
jserv Nov 11, 2026
730bd6a
Tidy doc comments and study closer tests
jserv Nov 11, 2026
80ce0fa
Cite a fixture for the comma-form bio rule
jserv Nov 12, 2026
783d391
Cite the native case behind the bio comma rule
jserv Nov 12, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
151 changes: 134 additions & 17 deletions assets/ruleset.json
Original file line number Diff line number Diff line change
Expand Up @@ -931,6 +931,26 @@
"context": "作為一名 sentence-initial calque; fold the role into the clause",
"tags": ["src:dewesternise"]
},
{
"from": "併且",
"to": ["並且"],
"type": "typo",
"context": "「併」作「並」用的錯字,常見於簡轉繁後的「并」誤轉。只列有實例的誤用詞(併把、併且);合併、兼併、吞併、歸併、整併、裁併、縮併等合併義複詞後接「且」時屬合併義,列為例外。未列的合併義複詞仍可能誤報,所以標為低信心,不進安全修正,須補入 exceptions",
"english": "and also (typo)",
"source": "tests/fixtures/opencc_residuals.tsv",
"exceptions": ["合併且", "兼併且", "吞併且", "歸併且", "整併且", "裁併且", "縮併且"],
"editorial_confidence": "low"
},
{
"from": "併把",
"to": ["並把"],
"type": "typo",
"context": "「併」作「並」用的錯字,常見於簡轉繁後的「并」誤轉。只列有實例的誤用詞(併把、併且);合併、兼併、吞併、歸併、整併、裁併、縮併等合併義複詞後接「把」時屬合併義,列為例外。未列的合併義複詞仍可能誤報,所以標為低信心,不進安全修正,須補入 exceptions",
"english": "and also (typo)",
"source": "tests/fixtures/opencc_residuals.tsv",
"exceptions": ["合併把", "兼併把", "吞併把", "歸併把", "整併把", "裁併把", "縮併把", "一併把"],
"editorial_confidence": "low"
},
{
"from": "併發",
"to": ["並行"],
Expand Down Expand Up @@ -3785,6 +3805,16 @@
"context": "@domain 程式設計",
"english": "object based"
},
{
"from": "基於我目前掌握的資訊",
"to": [],
"type": "ai_filler",
"context": "AI knowledge-cutoff disclaimer in the first person; gated on a hedge that shows the cutoff sense, since a human reporting status says the bare phrase too. State the source and date concretely instead",
"source": "ai_knowledge_cutoff_first_person",
"context_clues": ["無法確認", "無法保證", "無法驗證", "可能已", "最新消息", "最新資訊", "以官方為準", "請查證"],
"negative_context_clues": ["://", "「", "他說", "她說", "表示"],
"tags": ["src:humanizer"]
},
{
"from": "基於消息的",
"to": ["以訊息為基礎的"],
Expand Down Expand Up @@ -8409,8 +8439,9 @@
"from": "消息",
"to": ["訊息"],
"type": "cross_strait",
"context": "@domain IT。`好消息`/`壞消息`/`消息來源` 為合法 zh-TW 用法",
"context": "@domain IT。`好消息`/`壞消息`/`消息來源` 為合法 zh-TW 用法;新聞義的消息(得獎的消息、傳出消息)同為合法,僅在資訊系統語境才建議訊息",
"english": "message",
"context_clues": ["傳送", "發送", "接收", "佇列", "通訊", "中介軟體", "推送", "聊天", "回覆", "封包", "伺服器", "用戶端", "客戶端", "程式", "系統", "通知", "錯誤", "日誌", "協定", "訂閱", "發布"],
"positional_clues": ["not_after:好", "not_after:壞", "not_before:來源"]
},
{
Expand Down Expand Up @@ -8738,6 +8769,16 @@
"negative_context_clues": ["://", "doi", "參見", "註"],
"tags": ["src:humanizer"]
},
{
"from": "為人低調,鮮少公開",
"to": [],
"type": "ai_filler",
"disabled": true,
"context": "disabled: speculative biographical filler without evidence; comma form of the rule below, which spelling matching cannot reach across punctuation. It fired on plain native biography, and the tell is not lexical",
"source": "native_bio_low_profile_1",
"negative_context_clues": ["://", "doi", "參見", "註", "受訪", "本人", "自稱", "「"],
"tags": ["src:humanizer"]
},
{
"from": "烏茲別克斯坦",
"to": ["烏茲別克"],
Expand Down Expand Up @@ -9018,6 +9059,36 @@
"english": "specialization",
"context_clues": ["模板", "範本", "C++", "泛型"]
},
{
"from": "特此公告",
"to": [],
"type": "ai_filler",
"severity": "info",
"context": "officialese that reads as stiff outside a 公文; the rule applies only when the document is not in the formal register, where these forms are mandated",
"source": "ai_officialese_casual",
"tags": ["src:humanizer"],
"register": "casual"
},
{
"from": "特此說明",
"to": [],
"type": "ai_filler",
"severity": "info",
"context": "officialese that reads as stiff outside a 公文; the rule applies only when the document is not in the formal register, where these forms are mandated",
"source": "ai_officialese_casual",
"tags": ["src:humanizer"],
"register": "casual"
},
{
"from": "特此通知",
"to": [],
"type": "ai_filler",
"severity": "info",
"context": "officialese that reads as stiff outside a 公文; the rule applies only when the document is not in the formal register, where these forms are mandated",
"source": "ai_officialese_casual",
"tags": ["src:humanizer"],
"register": "casual"
},
{
"from": "特立尼達和多巴哥",
"to": ["千里達及托巴哥"],
Expand Down Expand Up @@ -9332,8 +9403,28 @@
"from": "當然可以",
"to": [],
"type": "ai_filler",
"context": "sycophantic chatbot opener; the answer shows the agreement",
"negative_context_clues": ["當然可以,", "當然可以。"],
"context": "sycophantic chatbot opener; the answer shows the agreement; a subject pronoun right before it (你當然可以這樣做) is ordinary speech, so only the sentence-initial 當然可以! and 當然可以這樣做 openers stay flagged",
"negative_context_clues": ["當然可以,", "當然可以。", "你當然可以", "您當然可以", "他當然可以", "她當然可以", "我們當然可以", "他們當然可以", "這當然可以", "那當然可以"],
"tags": ["src:humanizer"]
},
{
"from": "當然可以,以下是",
"to": [],
"type": "ai_filler",
"context": "sycophantic chatbot opener paired with a list lead-in; bare 當然可以, stays unflagged as ordinary speech, so this needs an addressee nearby; deliverable nouns such as 整理 or 步驟 open genuine tutorials too",
"source": "ai_collab_opener_list",
"context_clues": ["為你", "為您", "幫你", "幫您"],
"negative_context_clues": ["「", "『", "他說", "她說", "回答", "回覆"],
"tags": ["src:humanizer"]
},
{
"from": "當然可以,我來幫你",
"to": [],
"type": "ai_filler",
"context": "sycophantic chatbot opener paired with an offer to help; bare 當然可以, stays unflagged as ordinary speech, so this needs a task verb nearby",
"source": "ai_collab_opener_help",
"context_clues": ["說明", "整理", "解釋", "分析", "介紹", "解答", "撰寫", "改寫", "翻譯"],
"negative_context_clues": ["「", "『", "他說", "她說", "回答", "回覆"],
"tags": ["src:humanizer"]
},
{
Expand Down Expand Up @@ -9760,8 +9851,10 @@
"from": "社區",
"to": ["社群"],
"type": "cross_strait",
"context": "@domain 社群。「社區」指實體住宅區,online/tech community 語意不同",
"english": "community"
"context": "@domain 社群。「社區」指實體住宅區,online/tech community 語意不同;以線上/技術社群語境詞為條件,並排除住宅區語境",
"english": "community",
"context_clues": ["開源", "開發者", "軟體", "程式", "技術", "論壇", "線上", "網路", "貢獻", "社交", "演算法", "社群發現", "GitHub", "專案", "維護者", "使用者", "平台", "生態", "原始碼"],
"negative_context_clues": ["住戶", "居民", "管理委員會", "大樓", "里長", "鄰里", "住宅", "房價", "巷弄", "守望相助", "社區大學", "社區發展"]
},
{
"from": "祕",
Expand Down Expand Up @@ -11349,6 +11442,27 @@
"context": "cn 譯名,tw 官方與媒體通行「大英國協」",
"english": "Commonwealth of Nations"
},
{
"from": "茲因",
"to": [],
"type": "ai_filler",
"severity": "info",
"context": "officialese that reads as stiff outside a 公文; the rule applies only when the document is not in the formal register, where these forms are mandated",
"source": "ai_officialese_casual",
"tags": ["src:humanizer"],
"register": "casual"
},
{
"from": "茲將",
"to": [],
"type": "ai_filler",
"severity": "info",
"context": "officialese that reads as stiff outside a 公文; the rule applies only when the document is not in the formal register, where these forms are mandated",
"source": "ai_officialese_casual",
"exceptions": ["公告,茲將", "公告內容,茲將"],
"tags": ["src:humanizer"],
"register": "casual"
},
{
"from": "草泥馬",
"to": ["羊駝"],
Expand Down Expand Up @@ -12232,9 +12346,9 @@
},
{
"from": "說白了",
"to": ["說到底", "歸根究底"],
"to": ["簡單來說", "簡單地說"],
"type": "translationese",
"context": "PRC colloquial discourse marker (basically); zh-TW formal/informal both use 說到底 or 歸根究底",
"context": "PRC colloquial discourse marker (basically); zh-TW says 簡單來說. Not 說到底 or 歸根結底, which are fake-depth frames the structural scan reports",
"english": "basically (colloquial)",
"tags": ["src:cuimao", "topic:false_friends"]
},
Expand Down Expand Up @@ -13550,6 +13664,17 @@
"context": "@domain 日常",
"english": "close buddy"
},
{
"from": "鑑於",
"to": [],
"type": "ai_filler",
"severity": "info",
"disabled": true,
"context": "disabled: 鑑於 is ordinary written Taiwanese in news and policy prose, not only in a 公文, so the casual register gate cannot tell it from native use",
"source": "ai_officialese_casual",
"tags": ["src:humanizer"],
"register": "casual"
},
{
"from": "鑰匙扣",
"to": ["鑰匙圈"],
Expand Down Expand Up @@ -13669,15 +13794,6 @@
"negative_context_clues": ["論文", "研究", "分析", "評估"],
"tags": ["src:dewesternise"]
},
{
"from": "關鍵在於:",
"to": [],
"type": "ai_filler",
"disabled": true,
"context": "Watchlist only: a colon after 關鍵在於 ordinarily introduces the answer in technical zh-TW. Needs a second signal, or native-corpus counterexamples.",
"source": "tests/fixtures/writing_humanizer/pattern35_bad.txt",
"tags": ["src:humanizer"]
},
{
"from": "阿司匹林",
"to": ["阿斯匹靈"],
Expand Down Expand Up @@ -14021,7 +14137,8 @@
"from": "需要注意的是",
"to": [""],
"type": "ai_filler",
"context": "AI filler phrase with zero information content; delete"
"context": "AI filler phrase with zero information content; delete. Only the comma form is filler: 需要注意的是版本相容性 and 需要注意的是:以下三點 are copular or list lead-ins that native tutorials write, and deleting the phrase from them leaves a fragment",
"context_clues": ["需要注意的是,", "需要注意的是,"]
},
{
"from": "靈活性",
Expand Down
47 changes: 42 additions & 5 deletions docs/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ Options:
casing, punctuation, quotes, spacing, colon,
dunhao, range, variant, ellipsis, grammar, ai,
translationese, rhythm
--content-type <ct> plain, markdown, markdown-scan-code, or yaml
--content-type <ct> plain, markdown, markdown-scan-code, yaml, or json
--exclude <pattern> Skip matching paths (repeatable)
--max-errors <n> Fail when errors exceed n
--max-warnings <n> Fail when warnings exceed n
Expand Down Expand Up @@ -117,6 +117,40 @@ zhtw-mcp lint -- --content-type markdown < input.md
zhtw-mcp lint -- --content-type markdown-scan-code < input.md # also lint inside code blocks
```

### JSON files

A file named `*.json`, or any input under `--content-type json`, is linted as
locale-bundle prose: only the text of string values is scanned. Keys, structure,
quote marks, every escape sequence, and placeholders (`{name}`, `{{count}}`, `${name}`,
`$t(key)`, ICU `{n, plural, ...}` heads, `%s`, `%d`, `%1$s`, `%(name)s`) are excluded, so a term spelled
through an escape such as a backslash-u sequence is not seen. Findings carry
byte offsets into the file as written.

```bash
zhtw-mcp lint zh-TW.json
zhtw-mcp lint --content-type plain config.json # opt out for a non-locale file
```

`--fix` never lands inside an escape, and a fix whose replacement would contain a
double quote, a backslash or a control character is dropped, so a fixed file stays valid JSON. If a
string never closes, the whole file is linted as plain text and one line,
`warning: <file>: not valid JSON, linted as plain text`, goes to stderr; the exit
code is unchanged and the `--format json` findings are not affected.

`lint` never runs Simplified-to-Traditional conversion over a JSON file, because it
works on the whole text and would rewrite keys. A locale bundle is expected to be in
the language its name says, so a Simplified value is not converted or fixed here.
`zhtw-mcp convert` does convert one, in string values only.

JSONC and JSON5 are not supported: `.jsonc` and `.json5` are not mapped, comments
are treated as structure, and `--content-type json` on such a file may fall back to
plain text when a comment holds an unbalanced quote. Android `strings.xml` and
Fluent are not covered either.

JSON is only reached by naming a file or passing `--content-type json`; directory
walks and the git hook skip `.json`, so `package.json` and lockfiles are not
linted.

### Auto-fix

```bash
Expand Down Expand Up @@ -177,8 +211,9 @@ zhtw-mcp lint file.md --rhythm

`--rhythm` turns on the 氣口 checks: a sentence that runs past 30 CJK
characters without a pause, three or more consecutive sentences closing on the
same particle (的 / 了 / 呢), and a relaxed 定語堆疊 gate that no longer asks a
long unbroken span to contain several 的 before reporting it.
same particle (的 / 了 / 呢), three or more consecutive bare short sentences of
two to six CJK characters each (短句連發, 它來了。沒有猶豫。沒有退路。), and a
relaxed 定語堆疊 gate that no longer asks a long unbroken span to contain several 的 before reporting it.

Everything it reports is advisory. Rhythm findings carry `Info` severity, offer
no suggestion, and are left alone by every `--fix` tier including
Expand Down Expand Up @@ -423,7 +458,7 @@ Usage:
zhtw-mcp convert [--] < input.txt Convert stdin (the default)

Options:
--content-type <ct> plain, markdown, markdown-scan-code, or yaml
--content-type <ct> plain, markdown, markdown-scan-code, yaml, or json
--verify Confirm ambiguous substitutions via online
translation (sends text to the network,
requires the translate feature)
Expand All @@ -446,6 +481,8 @@ zhtw-mcp convert file.md --content-type markdown
zhtw-mcp --pack medical convert file.md
```

For a JSON file (`.json` or `--content-type json`) the conversion runs over string values only: keys, structure and escapes are left byte-for-byte, so the output has the same keys as the input. A file that is not valid JSON is converted as plain text.

This is a two-stage pipeline: first a built-in character/phrase converter (SC→TC), then iterative vocabulary normalization via the standard scanner.

### `--verify` sends text off the machine
Expand Down Expand Up @@ -492,7 +529,7 @@ Add to your `.pre-commit-config.yaml`:
- id: zhtw-mcp
```

The hook runs `zhtw-mcp lint` on staged Markdown, YAML, and text files.
The hook runs `zhtw-mcp lint` on staged Markdown, YAML, and text files. JSON is not in that list, and directory walks skip it for the same reason: `package.json` and lockfiles are not prose. A `.json` file is linted only when named as a file argument or selected with `--content-type json`.

## Rule packs

Expand Down
Loading
Loading