Files
cjk-autospace/rules/golden-vectors.json
T
admin 3a4fa1c932 fix: 修复行缘、切分还原与语言解析并同步文档
保留逐字 margin/jiya.bias 字体后备方案;补齐 demo 重排、量测边界说明及共享规则 1.0.1 反例向量。

验证:完整构建通过,Node 376 项、WKWebView 64 项及原生 demo 9 项通过;Firefox 仍暂缓。
2026-10-03 21:15:54 +08:00

416 lines
12 KiB
JSON
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
{
"$schema": "./golden-vectors.schema.json",
"schemaVersion": 1,
"rulesetVersion": "1.0.1",
"vectors": [
{
"id": "locale-ja",
"category": "language-classification",
"input": { "lang": "ja" },
"expected": { "langClass": "ja" }
},
{
"id": "locale-ja-jp",
"category": "language-classification",
"input": { "lang": "ja-JP" },
"expected": { "langClass": "ja" }
},
{
"id": "locale-zh-bare",
"category": "language-classification",
"input": { "lang": "zh" },
"expected": { "langClass": "zh-Hant" }
},
{
"id": "locale-zh-hant",
"category": "language-classification",
"input": { "lang": "zh-Hant" },
"expected": { "langClass": "zh-Hant" }
},
{
"id": "locale-zh-hans",
"category": "language-classification",
"input": { "lang": "zh-Hans" },
"expected": { "langClass": "zh-Hans" }
},
{
"id": "locale-zh-tw",
"category": "language-classification",
"input": { "lang": "zh-TW" },
"expected": { "langClass": "zh-Hant" }
},
{
"id": "locale-zh-hk",
"category": "language-classification",
"input": { "lang": "zh-HK" },
"expected": { "langClass": "zh-Hant" }
},
{
"id": "locale-zh-cn",
"category": "language-classification",
"input": { "lang": "zh-CN" },
"expected": { "langClass": "zh-Hans" }
},
{
"id": "locale-zhx-boundary",
"category": "language-classification",
"input": { "lang": "zhx" },
"expected": { "langClass": "other" }
},
{
"id": "locale-en",
"category": "language-classification",
"input": { "lang": "en" },
"expected": { "langClass": "other" }
},
{
"id": "locale-hans-private-hant",
"category": "language-classification",
"input": { "lang": "zh-Hans-x-hant" },
"expected": { "langClass": "zh-Hans" }
},
{
"id": "locale-tw-private-hans",
"category": "language-classification",
"input": { "lang": "zh-TW-x-hans" },
"expected": { "langClass": "zh-Hant" }
},
{
"id": "locale-latn-private-tw",
"category": "language-classification",
"input": { "lang": "zh-Latn-x-tw" },
"expected": { "langClass": "zh-Hans" }
},
{
"id": "locale-extension-hant",
"category": "language-classification",
"input": { "lang": "zh-CN-u-co-hant" },
"expected": { "langClass": "zh-Hans" }
},
{
"id": "locale-extlang-hans",
"category": "language-classification",
"input": { "lang": "zh-cmn-Hans-TW" },
"expected": { "langClass": "zh-Hans" }
},
{
"id": "locale-hant-cn",
"category": "language-classification",
"input": { "lang": "zh-Hant-CN" },
"expected": { "langClass": "zh-Hant" }
},
{
"id": "locale-empty",
"category": "language-classification",
"input": { "lang": "" },
"expected": { "langClass": "other" }
},
{
"id": "punct-stop",
"category": "punctuation-classification",
"input": { "character": "." },
"expected": { "punctuationClass": "stop" }
},
{
"id": "punct-pause",
"category": "punctuation-classification",
"input": { "character": "," },
"expected": { "punctuationClass": "pause" }
},
{
"id": "punct-open",
"category": "punctuation-classification",
"input": { "character": "「" },
"expected": { "punctuationClass": "open" }
},
{
"id": "punct-close",
"category": "punctuation-classification",
"input": { "character": "」" },
"expected": { "punctuationClass": "close" }
},
{
"id": "punct-middle",
"category": "punctuation-classification",
"input": { "character": "·" },
"expected": { "punctuationClass": "middle" }
},
{
"id": "punct-liga",
"category": "punctuation-classification",
"input": { "character": "…" },
"expected": { "punctuationClass": "liga" }
},
{
"id": "punct-base-with-vs",
"category": "punctuation-classification",
"input": { "character": "。︀" },
"expected": { "punctuationClass": "stop" }
},
{
"id": "punct-other",
"category": "punctuation-classification",
"input": { "character": "A" },
"expected": { "punctuationClass": null }
},
{
"id": "style-quanjiao-pause",
"category": "punctuation-style",
"input": { "style": "quanjiao", "punctuationClass": "pause" },
"expected": { "halfWidth": false }
},
{
"id": "style-kaiming-pause",
"category": "punctuation-style",
"input": { "style": "kaiming", "punctuationClass": "pause" },
"expected": { "halfWidth": true }
},
{
"id": "style-kaiming-open",
"category": "punctuation-style",
"input": { "style": "kaiming", "punctuationClass": "open" },
"expected": { "halfWidth": true }
},
{
"id": "style-kaiming-stop",
"category": "punctuation-style",
"input": { "style": "kaiming", "punctuationClass": "stop" },
"expected": { "halfWidth": false }
},
{
"id": "style-banjiao-stop",
"category": "punctuation-style",
"input": { "style": "banjiao", "punctuationClass": "stop" },
"expected": { "halfWidth": true }
},
{
"id": "style-banjiao-liga",
"category": "punctuation-style",
"input": { "style": "banjiao", "punctuationClass": "liga" },
"expected": { "halfWidth": false }
},
{
"id": "adjacency-pause-open",
"category": "punctuation-adjacency",
"input": { "left": "pause", "right": "open" },
"expected": { "squeezeLeft": true, "squeezeRight": true }
},
{
"id": "adjacency-stop-open",
"category": "punctuation-adjacency",
"input": { "left": "stop", "right": "open" },
"expected": { "squeezeLeft": false, "squeezeRight": true }
},
{
"id": "adjacency-stop-close",
"category": "punctuation-adjacency",
"input": { "left": "stop", "right": "close" },
"expected": { "squeezeLeft": true, "squeezeRight": false }
},
{
"id": "adjacency-close-open",
"category": "punctuation-adjacency",
"input": { "left": "close", "right": "open" },
"expected": { "squeezeLeft": true, "squeezeRight": true }
},
{
"id": "adjacency-middle-liga",
"category": "punctuation-adjacency",
"input": { "left": "middle", "right": "liga" },
"expected": { "squeezeLeft": false, "squeezeRight": false }
},
{
"id": "spacing-cjk-latin",
"category": "spacing",
"input": { "text": "中A" },
"expected": { "managedGaps": 1, "normalizedText": "中A", "gapEm": 0.25 }
},
{
"id": "spacing-latin-cjk",
"category": "spacing",
"input": { "text": "A中" },
"expected": { "managedGaps": 1, "normalizedText": "A中", "gapEm": 0.25 }
},
{
"id": "spacing-cjk-at",
"category": "spacing",
"input": { "text": "中@" },
"expected": { "managedGaps": 1, "normalizedText": "中@", "gapEm": 0.25 }
},
{
"id": "spacing-at-cjk-asymmetric",
"category": "spacing",
"input": { "text": "@中" },
"expected": { "managedGaps": 0, "normalizedText": "@中" }
},
{
"id": "spacing-author-space-cjk-latin",
"category": "spacing",
"input": { "text": "中 A" },
"expected": {
"managedGaps": 1,
"normalizedText": "中A",
"authorSpaceDisposition": "remove-and-use-managed-gap"
}
},
{
"id": "spacing-author-space-latin-cjk",
"category": "spacing",
"input": { "text": "A 中" },
"expected": {
"managedGaps": 1,
"normalizedText": "A中",
"authorSpaceDisposition": "remove-and-use-managed-gap"
}
},
{
"id": "spacing-author-space-cjk-cjk",
"category": "spacing",
"input": { "text": "中 文" },
"expected": {
"managedGaps": 0,
"normalizedText": "中文",
"authorSpaceDisposition": "remove-without-gap"
}
},
{
"id": "spacing-cjk-punctuation-latin",
"category": "spacing",
"input": { "text": "中。A" },
"expected": { "managedGaps": 0, "normalizedText": "中。A" }
},
{
"id": "spacing-astral-ivs-latin",
"category": "spacing",
"input": { "text": "𠀀󠄀A" },
"expected": { "managedGaps": 1, "normalizedText": "𠀀󠄀A", "gapEm": 0.25 }
},
{
"id": "atom-bmp-vs",
"category": "ivs-atom",
"input": { "text": "中︀A" },
"expected": { "atoms": [ "中︀", "A" ] }
},
{
"id": "atom-astral-ivs",
"category": "ivs-atom",
"input": { "text": "𠀀󠄀A" },
"expected": { "atoms": [ "𠀀󠄀", "A" ] }
},
{
"id": "atom-at-most-one-vs",
"category": "ivs-atom",
"input": { "text": "中︀︁" },
"expected": { "atoms": [ "中︀", "︁" ] }
},
{
"id": "atom-isolated-vs",
"category": "ivs-atom",
"input": { "text": "︀A" },
"expected": { "atoms": [ "︀", "A" ] }
},
{
"id": "jinze-before-stop",
"category": "jinze",
"input": { "left": "A", "right": "。" },
"expected": { "prohibitedBreak": true, "reason": "before-stop" }
},
{
"id": "jinze-before-close",
"category": "jinze",
"input": { "left": "中", "right": "」" },
"expected": { "prohibitedBreak": true, "reason": "before-close" }
},
{
"id": "jinze-after-open",
"category": "jinze",
"input": { "left": "「", "right": "A" },
"expected": { "prohibitedBreak": true, "reason": "after-open" }
},
{
"id": "jinze-ordinary-boundary",
"category": "jinze",
"input": { "left": "中", "right": "A" },
"expected": { "prohibitedBreak": false }
},
{
"id": "jinze-supplementary-ivs-before-stop",
"category": "jinze",
"input": { "left": "𠀀\uDB40\uDD00", "right": "。" },
"expected": {
"prohibitedBreak": true,
"reason": "before-stop",
"atoms": [ "𠀀\uDB40\uDD00", "。" ]
}
},
{
"id": "jinze-second-vs-before-stop",
"category": "jinze",
"input": { "left": "𠀀\uDB40\uDD00\uDB40\uDD01", "right": "。" },
"expected": {
"prohibitedBreak": true,
"reason": "before-stop",
"atoms": [ "𠀀\uDB40\uDD00", "\uDB40\uDD01", "。" ]
}
},
{
"id": "jinze-open-before-second-isolated-vs",
"category": "jinze",
"input": { "left": "「\uFE00", "right": "\uDB40\uDD00" },
"expected": {
"prohibitedBreak": true,
"reason": "after-open",
"atoms": [ "「\uFE00", "\uDB40\uDD00" ]
}
},
{
"id": "orphan-default-two",
"category": "orphan",
"input": { "text": "天地玄黃", "minimum": 2 },
"expected": { "meaningfulCjkCount": 4, "protectedSuffix": "玄黃" }
},
{
"id": "orphan-trailing-punctuation",
"category": "orphan",
"input": { "text": "天地。", "minimum": 2 },
"expected": { "meaningfulCjkCount": 2, "protectedSuffix": "天地。" }
},
{
"id": "orphan-insufficient-cjk",
"category": "orphan",
"input": { "text": "天。", "minimum": 2 },
"expected": { "meaningfulCjkCount": 1, "protectedSuffix": null }
},
{
"id": "orphan-supplementary-ivs",
"category": "orphan",
"input": { "text": "甲𠀀\uDB40\uDD00", "minimum": 2 },
"expected": {
"meaningfulCjkCount": 2,
"protectedSuffix": "甲𠀀\uDB40\uDD00",
"atoms": [ "甲", "𠀀\uDB40\uDD00" ]
}
},
{
"id": "orphan-second-vs",
"category": "orphan",
"input": { "text": "甲𠀀\uDB40\uDD00\uDB40\uDD01", "minimum": 2 },
"expected": {
"meaningfulCjkCount": 2,
"protectedSuffix": "甲𠀀\uDB40\uDD00\uDB40\uDD01",
"atoms": [ "甲", "𠀀\uDB40\uDD00", "\uDB40\uDD01" ]
}
},
{
"id": "orphan-isolated-vs-prefix",
"category": "orphan",
"input": { "text": "\uDB40\uDD00甲𠀀\uDB40\uDD01", "minimum": 2 },
"expected": {
"meaningfulCjkCount": 2,
"protectedSuffix": "甲𠀀\uDB40\uDD01",
"atoms": [ "\uDB40\uDD00", "甲", "𠀀\uDB40\uDD01" ]
}
}
]
}