Problem
From verify of #115 (DA P2 #2 + Codex P2 #3):
「lib 的 mathScriptVariantMap 是手動列舉式,漏掉:(a) combining macron U+0304 — issue body 明確列 X̄ = X + ̄ 為典型 anchor pattern;(b) Greek subscripts U+1D66..U+1D6A (ᵦᵧᵨᵩᵪ) — 統計/物理論文 Σᵦ、Πᵧ 等常用標記;(c) U+2094 ₔ(subscript schwa) — 罕見但若驗收標準是『完整 U+2090..U+209C』,這裡還不完整。」
— Source: team:devils-advocate (P2) + codex (P2/P3)
Verify report: #115 (comment)
Type
enhancement / cross-repo (ooxml-swift + che-word-mcp)
Affected location
packages/ooxml-swift/Sources/OOXMLSwift/Models/InsertLocation.swift:75-90 (mathScriptVariantMap)
Sources/CheWordMCP/Server.swift schema descriptions (跟 issue P3 配合)
Strategy
1. NFD normalization for combining marks:
Combining macron U+0304 必須先 Unicode NFD decompose 再 strip。X̄ 在 NFC 是 X + ̄(2 char),NFD 同樣。strip combining marks 後得到 X。建議:
extension String {
var stripCombiningMarks: String {
let nfd = self.decomposedStringWithCanonicalMapping // NSString.precomposedStringWithCanonicalMapping
return String(nfd.unicodeScalars.filter { !$0.properties.isDiacritic })
}
}
// In matcher:
let canonicalNeedle = mapToAscii(needle.stripCombiningMarks)
let canonicalHaystack = mapToAscii(haystack.stripCombiningMarks)
2. Greek subscript range U+1D66..U+1D6A:
| Code |
Char |
ASCII map |
| U+1D66 |
ᵦ |
β |
| U+1D67 |
ᵧ |
γ |
| U+1D68 |
ᵨ |
ρ |
| U+1D69 |
ᵩ |
φ |
| U+1D6A |
ᵪ |
χ |
加進 mathScriptVariantMap。
3. U+2094 ₔ subscript schwa:
加 (0x2094, "ə")。
Test
H̄ (combining macron) flag on → match H
X̄ + Ȳ flag on → match needle X + Y
Σᵦ flag on → match Σβ
aₔb flag on → match aəb
- 跨 case:
X̄ 與 X flag on 雙向 match
Related
Problem
Type
enhancement / cross-repo (ooxml-swift + che-word-mcp)
Affected location
packages/ooxml-swift/Sources/OOXMLSwift/Models/InsertLocation.swift:75-90(mathScriptVariantMap)Sources/CheWordMCP/Server.swiftschema descriptions (跟 issue P3 配合)Strategy
1. NFD normalization for combining marks:
Combining macron
U+0304必須先 Unicode NFD decompose 再 strip。X̄在 NFC 是X + ̄(2 char),NFD 同樣。strip combining marks 後得到X。建議:2. Greek subscript range U+1D66..U+1D6A:
加進
mathScriptVariantMap。3. U+2094
ₔsubscript schwa:加
(0x2094, "ə")。Test
H̄(combining macron) flag on → matchHX̄ + Ȳflag on → match needleX + YΣᵦflag on → matchΣβaₔbflag on → matchaəbX̄與Xflag on 雙向 matchRelated