vChewing-macOS/Packages/vChewing_MainAssembly/Sources/MainAssembly/SymbolMenuDefaultData.swift

571 lines
45 KiB
Swift
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.

// (c) 2021 and onwards The vChewing Project (MIT-NTL License).
// ====================
// This code is released under the MIT license (SPDX-License-Identifier: MIT)
// ... with NTL restriction stating that:
// No trademark license is granted to use the trade names, trademarks, service
// marks, or product names of Contributor, except as required to fulfill notice
// requirements defined in MIT License.
import AppKit
import Shared
extension CandidateNode {
public static func load(url: URL) {
DispatchQueue.main.async {
//
var arrLines = [String.SubSequence]()
var fieldSlice = [Substring.SubSequence]()
var arrMembers = [CandidateNode]()
do {
arrLines = try String(contentsOfFile: url.path, encoding: .utf8).split(separator: "\n")
for strLine in arrLines.lazy.filter({ !$0.isEmpty }) {
fieldSlice = strLine.split(separator: "=")
switch fieldSlice.count {
case 1: arrMembers.append(.init(name: String(fieldSlice[0])))
case 2:
arrMembers.append(
.init(
name: String(fieldSlice[0]),
symbols: .init(
fieldSlice[1].map(\.description)
)
)
)
default: break
}
}
Self.root = arrMembers.isEmpty ? defaultSymbolRoot : .init(name: "/", members: arrMembers)
} catch {
Self.root = defaultSymbolRoot
}
}
}
// MARK: - Static data.
static let catCommonSymbols = NSLocalizedString("catCommonSymbols", comment: "")
static let catHoriBrackets = NSLocalizedString("catHoriBrackets", comment: "")
static let catVertBrackets = NSLocalizedString("catVertBrackets", comment: "")
static let catAlphabets = NSLocalizedString("catAlphabets", comment: "")
static let catRadicals = NSLocalizedString("catRadicals", comment: "")
static let catSpecialNumbers = NSLocalizedString("catSpecialNumbers", comment: "")
static let catMathSymbols = NSLocalizedString("catMathSymbols", comment: "")
static let catCurrencyUnits = NSLocalizedString("catCurrencyUnits", comment: "")
static let catSpecialSymbols = NSLocalizedString("catSpecialSymbols", comment: "")
static let catUnicodeSymbols = NSLocalizedString("catUnicodeSymbols", comment: "")
static let catCircledKanjis = NSLocalizedString("catCircledKanjis", comment: "")
static let catCircledKataKana = NSLocalizedString("catCircledKataKana", comment: "")
static let catBracketKanjis = NSLocalizedString("catBracketKanjis", comment: "")
static let catSingleTableLines = NSLocalizedString("catSingleTableLines", comment: "")
static let catDoubleTableLines = NSLocalizedString("catDoubleTableLines", comment: "")
static let catFillingBlocks = NSLocalizedString("catFillingBlocks", comment: "")
static let catLineSegments = NSLocalizedString("catLineSegments", comment: "")
static let catKana = NSLocalizedString("catKana", comment: "")
static let catCombinations = NSLocalizedString("catCombinations", comment: "")
static let catPhonabets = NSLocalizedString("catPhonabets", comment: "")
static let catCircledASCII = NSLocalizedString("catCircledASCII", comment: "")
static let catBracketedASCII = NSLocalizedString("catBracketedASCII", comment: "")
static let catMusicSymbols = NSLocalizedString("catMusicSymbols", comment: "")
static let catThai = NSLocalizedString("catThai", comment: "")
static let catYi = NSLocalizedString("catYi", comment: "")
static func strCountStrokes(_ count: Int) -> String {
String(format: NSLocalizedString("%@-Stroke", comment: ""), count.kanji)
}
private static let defaultSymbolRoot: CandidateNode = .init(
name: "/",
members: [
CandidateNode(name: " "),
CandidateNode(name: ""),
.nodeForCommonSymbols, .nodeForHoriBrackets, .nodeForVertBrackets, .nodeForAlphabets,
.nodeForRadicals, .nodeForSpecialNumbers, .nodeForMathSymbols, .nodeForCurrencyUnits,
.nodeForSpecialSymbols, .nodeForUnicodeSymbols, .nodeForMusicSymbols,
.nodeForCircledKanjis, .nodeForCircledKataKana, .nodeForBracketKanjis,
.nodeForSingleTableLines, .nodeForDoubleTableLines, .nodeForFillingBlocks,
.nodeForLineSegments, .nodeForKana, .nodeForCombinations, .nodeForPhonabets,
.nodeForCircledASCII, .nodeForBracketedASCII, .nodeForThai, .nodeForYi,
]
)
}
// MARK: - Hanin Symbol Support (except Ctrl+3 menu).
public extension CandidateNode {
static func queryHaninKeyboardSymbols(char key: String) -> CandidateNode? {
guard let rawData = Self.mapHaninKeyboardSymbols[key] else { return nil }
return CandidateNode(name: key, symbols: rawData)
}
// Ref: https://github.com/vChewing/vChewing-macOS/wiki/HaninFormatSpec
static let mapHaninKeyboardSymbols: [String: [String]] = [
" ": [" "],
"(": ["", "", "", "", "", ""],
")": ["", "", "", "", "", ""],
"+": ["", "", "", "", "", "±", ""],
",": ["", "", "", "", ""],
"-": [
"", "", "", "", "", "÷", "±", "", "",
"", "", "", "", "", "", "", "", "",
],
".": ["", "", "", "", "·", "", "÷", "", "", "", "", "", ""],
"/": ["", "", "", "", "", "", "", ""],
"0": ["", "", "", "", "", "", ""],
"1": ["", "", "", ""],
"2": ["", "", "", "", ""],
"3": ["", "", "ˇ", "", ""],
"4": ["", "", "ˋ", "", "", "", "§"],
"5": ["", "", "", "", "", "Λ"],
"6": ["", "", "ˊ", "︿", "", ""],
"7": ["", "", "˙", "", ""],
"8": ["", "", "", "", "", "", ""],
"9": ["", "", "", "", "", "", ""],
":": ["", "", "", "", ""],
";": ["", "", "", "", "", ""],
"<": [
"", "", "", "", "", "", "", "", "",
"", "", "", "︿", "", "", "", "Δ", "", "",
"", "", "", "", "", "", "", "", "", "",
],
">": [
"", "", "", "", "", "", "÷", "",
"", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "",
],
"=": ["", "", "", "", "", "", ""],
"?": ["", ""],
"a": ["", "", "", "Α", "", "α"],
"b": ["", "", "", "Β", "", "β"],
"c": ["", "", "", "", "Γ", "", ""],
"d": ["", "", "", "Δ", "δ", ""],
"e": ["", "", "", "ε", "Ε", ""],
"f": ["", "", "", "", ""],
"g": ["", "", "", ""],
"h": ["", "", "", "Η", ""],
"i": ["", "", "", "Ι", "ι", ""],
"j": ["", "", "", ""],
"k": ["", "", "", "Κ", "κ", ""],
"l": ["", "", "", "Γ", "", "", "λ", ""],
"m": ["", "", "", "Ο", "Μ", "Σ", ""],
"n": ["", "", "", "Ν", "", "η"],
"o": ["", "", "", "", "", "", "", "Θ", "Ο", "Φ", "θ", "ο", "φ", ""],
"p": ["", "", "", "π", "Ρ", ""],
"q": ["", "", "", ""],
"r": ["", "", "", "γ", "ρ", ""],
"s": ["", "", "", "", "", "σ", ""],
"t": ["", "", "", "Τ", "Υ", "廿"],
"u": ["", "", "", "", "", "Π", "Ψ", "μ", "ψ", ""],
"v": ["", "", "", "", "", "", "", "", "", "", "ν", "υ", ""],
"w": ["", "", "", "Ω", "ω", ""],
"x": ["", "", "", "×", "", "Χ", "χ", "ξ"],
"y": ["", "", "", "", ""],
"z": ["Ζ", "", "", "τ"],
"[": ["", "", "", "", "", "", "", "", ""],
"\"": ["", "", "", "", ""],
"\'": ["", "", "", ""],
"]": ["", "", "", "", "", "", "", "", "", "", ""],
"_": ["_", "ˍ"],
"`": ["", ""],
"{": ["", "", ""],
"}": ["", "", ""],
"~": ["", "", ""],
]
}
// MARK: - Radicals.
extension CandidateNode {
static var nodeForRadicals: CandidateNode {
CandidateNode(
name: catRadicals,
members: radicalMap.sorted { $0.key < $1.key }.map { key, rawData in
CandidateNode(name: strCountStrokes(key), symbols: rawData)
}
)
}
static let radicalMap: [Int: [String]] = [
1: ["", "", "", "丿", "", "", "", ""],
2: [
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "",
],
3: [
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "广", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "",
],
4: [
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
],
5: [
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "",
],
6: [
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"",
],
7: [
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "",
],
8: [
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "",
],
9: [
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "齿",
], 10: ["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
11: ["", "", "", "", "", "", "", "", "", "鹿", "", ""],
12: ["", "", "", "鹿", "", "", "", "", "", "", ""],
13: ["", "", "", "", "", "", ""], 14: ["", "", "", ""], 15: ["", "", ""],
16: ["", "", "", ""],
]
}
// MARK: - Other Default Symbol Nodes.
extension CandidateNode {
private static let nodeForCommonSymbols = CandidateNode(
name: catCommonSymbols,
symbols: [
"", "", "", "", "", "", "", "", "", "", "", "", "˙", "·", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "_", "", "", "", "", "", "",
]
)
private static let nodeForHoriBrackets = CandidateNode(
name: catHoriBrackets,
symbols: [
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "︿", "", "", "", "", "", "", "", "", "",
"[", "]", "{", "}", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "",
]
)
private static let nodeForVertBrackets = CandidateNode(
name: catVertBrackets,
symbols: ["", "", "", "", "", "", "", "", "︿", "", "", "", "", "", "", ""]
)
private static let nodeForAlphabets = CandidateNode(
name: catAlphabets,
symbols: [
"α", "β", "γ", "δ", "ε", "ζ", "η", "θ", "ι", "κ", "λ", "μ", "ν", "ξ", "ο", "π", "ρ", "σ", "τ", "υ", "φ", "χ",
"ψ", "ω", "Α", "Β", "Γ", "Δ", "Ε", "Ζ", "Η", "Θ", "Ι", "Κ", "Λ", "Μ", "Ν", "Ξ", "Ο", "Π", "Ρ", "Σ", "Τ", "Υ",
"Φ", "Χ", "Ψ", "Ω", "а", "б", "в", "г", "д", "е", "ж", "з", "и", "й", "к", "л", "м", "н", "о", "п", "р", "с",
"т", "у", "ф", "х", "ц", "ч", "ш", "щ", "ъ", "ы", "ь", "э", "ю", "я", "ё", "А", "Б", "В", "Г", "Д", "Е", "Ж",
"З", "И", "Й", "К", "Л", "М", "Н", "О", "П", "Р", "С", "Т", "У", "Ф", "Х", "Ц", "Ч", "Ш", "Щ", "Ъ", "Ы", "Ь",
"Э", "Ю", "Я", "Ё", "à", "á", "è", "é", "ê", "ì", "í", "ò", "ó", "ù", "ú", "ü", "ā", "ē", "ě", "ī", "ń", "ň",
"ō", "ū", "ǎ", "ǐ", "ǒ", "ǔ", "ǖ", "ǘ", "ǚ", "ǜ", "ɑ", "ɡ", "¨", "·",
]
)
private static let nodeForSpecialNumbers = CandidateNode(
name: catSpecialNumbers,
symbols: [
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "",
]
)
private static let nodeForMathSymbols = CandidateNode(
name: catMathSymbols,
symbols: [
"", "", "", "", "", "", "", "", "", "%", "+", "<", "=", ">", "¡", "¢", "«", "°", "±", "µ", "»", "¼",
"½", "¾", "¿", "×", "÷", "ˇ", "θ", "π", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
]
)
private static let nodeForCurrencyUnits = CandidateNode(
name: catCurrencyUnits,
symbols: [
"$", "", "¥", "¢", "£", "", "", "", "฿", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "¤", "", "", "", "",
"", "",
]
)
private static let nodeForSpecialSymbols = CandidateNode(
name: catSpecialSymbols,
symbols: [
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "§", "", "", "", "", "", "©", "®",
"", "🜀", "🜁", "🜂", "🜃", "🜄", "🜅", "🜆", "🜇", "🜈", "🜉", "🜊", "🜋", "🜌", "🜍", "🜎", "🜏", "🜐", "🜑", "🜒", "🜓", "🜔",
"🜕", "🜖", "🜗", "🜘", "🜙", "🜚", "🜛", "🜜", "🜝", "🜞", "🜟", "🜠", "🜡", "🜢", "🜣", "🜤", "🜥", "🜦", "🜧", "🜨", "🜩", "🜪",
"🜫", "🜬", "🜭", "🜮", "🜯", "🜰", "🜱", "🜲", "🜳", "🜴", "🜵", "🜶", "🜷", "🜸", "🜹", "🜺", "🜻", "🜼", "🜽", "🜾", "🜿", "🝀",
"🝁", "🝂", "🝃", "🝄", "🝅", "🝆", "🝇", "🝈", "🝉", "🝊", "🝋", "🝌", "🝍", "🝎", "🝏", "🝐", "🝑", "🝒", "🝓", "🝔", "🝕", "🝖",
"🝗", "🝘", "🝙", "🝚", "🝛", "🝜", "🝝", "🝞", "🝟", "🝠", "🝡", "🝢", "🝣", "🝤", "🝥", "🝦", "🝧", "🝨", "🝩", "🝪", "🝫", "🝬",
"🝭", "🝮", "🝯", "🝰", "🝱", "🝲", "🝳", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "",
]
)
private static let nodeForUnicodeSymbols = CandidateNode(
name: catUnicodeSymbols,
symbols: [
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "⬿", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "",
]
)
private static let nodeForMusicSymbols = CandidateNode(
name: catMusicSymbols,
symbols: [
"𝄀", "𝄁", "𝄂", "𝄃", "𝄄", "𝄅", "𝄆", "𝄇", "𝄈", "𝄉", "𝄊", "𝄋", "𝄌", "𝄍", "𝄎", "𝄏", "𝄐", "𝄑", "𝄒", "𝄓", "𝄔", "𝄕",
"𝄖", "𝄗", "𝄘", "𝄙", "𝄚", "𝄛", "𝄜", "𝄝", "𝄞", "𝄟", "𝄠", "𝄡", "𝄢", "𝄣", "𝄤", "𝄥", "𝄦", "𝄩", "𝄪", "𝄫", "𝄬", "𝄭",
"𝄮", "𝄯", "𝄰", "𝄱", "𝄲", "𝄳", "𝄴", "𝄵", "𝄶", "𝄷", "𝄸", "𝄹", "𝄺", "𝄻", "𝄼", "𝄽", "𝄾", "𝄿", "𝅀", "𝅁", "𝅂", "𝅃",
"𝅄", "𝅅", "𝅆", "𝅇", "𝅈", "𝅉", "𝅊", "𝅋", "𝅌", "𝅍", "𝅎", "𝅏", "𝅐", "𝅑", "𝅒", "𝅓", "𝅔", "𝅕", "𝅖", "𝅗", "𝅗𝅥", "𝅘",
"𝅘𝅥", "𝅘𝅥𝅮", "𝅘𝅥𝅯", "𝅘𝅥𝅰", "𝅘𝅥𝅱", "𝅘𝅧𝅨𝅩𝅥𝅲𝅥𝅦", "𝅙", "𝅚", "𝅛", "𝅜", "𝅝", "𝅪", "𝅫", "𝅬𝅮𝅯𝅰𝅱𝅲𝅭", "𝅳", "𝅴", "𝅵", "𝅶", "𝅷", "𝅸", "𝅹", "𝅺",
"𝅻𝅼𝅽𝅾𝅿𝆀𝆁𝆂", "𝆃", "𝆄𝆊𝆋𝆅𝆆𝆇𝆈𝆉", "𝆌", "𝆍", "𝆎", "𝆏", "𝆐", "𝆑", "𝆒", "𝆓", "𝆔", "𝆕", "𝆖", "𝆗", "𝆘", "𝆙", "𝆚", "𝆛", "𝆜", "𝆝", "𝆞",
"𝆟", "𝆠", "𝆡", "𝆢", "𝆣", "𝆤", "𝆥", "𝆦", "𝆧", "𝆨", "𝆩𝆪𝆫𝆬𝆭", "𝆮", "𝆯", "𝆰", "𝆱", "𝆲", "𝆳", "𝆴", "𝆵", "𝆶", "𝆷", "𝆸",
"𝆹", "𝆹𝅥", "𝆹𝅥𝅮", "𝆹𝅥𝅯", "𝆺", "𝆺𝅥", "𝆺𝅥𝅮", "𝆺𝅥𝅯", "𝇁", "𝇂", "𝇃", "𝇄", "𝇅", "𝇆", "𝇇", "𝇈", "𝇉", "𝇊", "𝇋", "𝇌", "𝇍", "𝇎",
"𝇏", "𝇐", "𝇑", "𝇒", "𝇓", "𝇔", "𝇕", "𝇖", "𝇗", "𝇘", "𝇙", "𝇚", "𝇛", "𝇜", "𝇝", "𝇞", "𝇟", "𝇠", "𝇡", "𝇢", "𝇣", "𝇤",
"𝇥", "𝇦", "𝇧", "𝇨",
]
)
private static let nodeForCircledKanjis = CandidateNode(
name: catCircledKanjis,
symbols: [
"", "", "", "", "", "", "", "", "", "", "", "", "", "㊗︎", "", "㊙︎", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "🈚︎", "🈯︎",
]
)
private static let nodeForCircledKataKana = CandidateNode(
name: catCircledKataKana,
symbols: [
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "",
]
)
private static let nodeForBracketKanjis = CandidateNode(
name: catBracketKanjis,
symbols: [
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "",
]
)
private static let nodeForSingleTableLines = CandidateNode(
name: catSingleTableLines,
symbols: [
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
]
)
private static let nodeForDoubleTableLines = CandidateNode(
name: catDoubleTableLines,
symbols: [
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "",
]
)
private static let nodeForFillingBlocks = CandidateNode(
name: catFillingBlocks,
symbols: [
"_", "ˍ", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
]
)
private static let nodeForLineSegments = CandidateNode(
name: catLineSegments,
symbols: [
"", "", "", "", "", "", "", "", "", "", "", "¯", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "ˍ", "", "", "", "", "", "", "ˆ", "", "", "", "", "", "", "", "", "",
]
)
private static let nodeForKana = CandidateNode(
name: catKana,
symbols: [
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "ら゚", "", "り゚", "", "る゚", "", "れ゚", "", "ろ゚", "", "", "わ゙", "", "ゐ゙", "", "ゑ゙", "", "を゙", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "ラ゚", "", "リ゚", "", "ル゚", "", "レ゚",
"", "ロ゚", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "ソ", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "",
]
)
private static let nodeForCombinations = CandidateNode(
name: catCombinations,
symbols: [
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
]
)
private static let nodeForPhonabets = CandidateNode(
name: catPhonabets,
symbols: [
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "˙", "ˊ", "ˇ", "ˋ", "˪", "˫",
]
)
private static let nodeForCircledASCII = CandidateNode(
name: catCircledASCII,
symbols: [
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "Ⓜ︎", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "🄰", "🄱", "🄲", "🄳", "🄴", "🄵", "🄶",
"🄷", "🄸", "🄹", "🄺", "🄻", "🄼", "🄽", "🄾", "🄿", "🅀", "🅁", "🅂", "🅃", "🅄", "🅅", "🅆", "🅇", "🅈", "🅉", "🅐", "🅑", "🅒",
"🅓", "🅔", "🅕", "🅖", "🅗", "🅘", "🅙", "🅚", "🅛", "🅜", "🅝", "🅞", "🅟", "🅠", "🅡", "🅢", "🅣", "🅤", "🅥", "🅦", "🅧", "🅨",
"🅩", "🅰", "🅱", "🅲", "🅳", "🅴", "🅵", "🅶", "🅷", "🅸", "🅹", "🅺", "🅻", "🅼", "🅽", "🅾", "🅿︎", "🆀", "🆁", "🆂", "🆃", "🆄",
"🆅", "🆆", "🆇", "🆈", "🆉",
]
)
private static let nodeForBracketedASCII = CandidateNode(
name: catBracketedASCII,
symbols: [
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "🄐", "🄑", "🄒", "🄓", "🄔", "🄕", "🄖", "🄗", "🄘", "🄙", "🄚", "🄛", "🄜", "🄝", "🄞", "🄟", "🄠", "🄡", "🄢", "🄣",
"🄤", "🄥", "🄦", "🄧", "🄨", "🄩",
]
)
private static let nodeForThai = CandidateNode(
name: catThai,
symbols: [
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
]
)
private static let nodeForYi = CandidateNode(
name: catYi,
symbols: [
"ꀀ", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "",
]
)
}
private extension BinaryInteger {
var kanji: String {
guard let prefix = PrefMgr.shared.appleLanguages.first?.prefix(2), ["zh", "ja"].contains(prefix) else { return description }
let formatter = NumberFormatter()
formatter.locale = Locale(identifier: prefix.description)
formatter.numberStyle = .spellOut
return formatter.string(from: NSDecimalNumber(string: "\(self)")) ?? ""
}
}