LMMgr // Load corresponded data model on .tagOverrides().

This commit is contained in:
ShikiSuen 2022-12-11 19:51:46 +08:00
parent c1350bccc3
commit 00ce1f23ce
1 changed files with 27 additions and 0 deletions

View File

@ -792,6 +792,33 @@ extension LMMgr: PhraseEditorDelegate {
public func tagOverrides(in strProcessed: inout String, mode: Shared.InputMode) { public func tagOverrides(in strProcessed: inout String, mode: Shared.InputMode) {
let outputStack: NSMutableString = .init() let outputStack: NSMutableString = .init()
switch mode {
case .imeModeCHT:
if !Self.lmCHT.isCoreLMLoaded {
Notifier.notify(
message: NSLocalizedString("Loading CHT Core Dict...", comment: "")
)
Self.loadCoreLanguageModelFile(
filenameSansExtension: "data-cht", langModel: &Self.lmCHT
)
Notifier.notify(
message: NSLocalizedString("Core Dict loading complete.", comment: "")
)
}
case .imeModeCHS:
if !Self.lmCHS.isCoreLMLoaded {
Notifier.notify(
message: NSLocalizedString("Loading CHS Core Dict...", comment: "")
)
Self.loadCoreLanguageModelFile(
filenameSansExtension: "data-chs", langModel: &Self.lmCHS
)
Notifier.notify(
message: NSLocalizedString("Core Dict loading complete.", comment: "")
)
}
case .imeModeNULL: return
}
for currentLine in strProcessed.split(separator: "\n") { for currentLine in strProcessed.split(separator: "\n") {
let arr = currentLine.split(separator: " ") let arr = currentLine.split(separator: " ")
guard arr.count >= 2 else { continue } guard arr.count >= 2 else { continue }