diff --git a/Source/Modules/LangModelRelated/LMInstantiator.swift b/Source/Modules/LangModelRelated/LMInstantiator.swift index 6b23d699..3427c7ff 100644 --- a/Source/Modules/LangModelRelated/LMInstantiator.swift +++ b/Source/Modules/LangModelRelated/LMInstantiator.swift @@ -98,6 +98,8 @@ extension vChewing { if path.contains("vChewing/") { lmCore.dump() } + } else { + IME.prtDebugIntel("lmCore: File access failure: \(path)") } } @@ -109,6 +111,8 @@ extension vChewing { if path.contains("vChewing/") { lmCNS.dump() } + } else { + IME.prtDebugIntel("lmCNS: File access failure: \(path)") } } @@ -120,6 +124,8 @@ extension vChewing { if path.contains("vChewing/") { lmMisc.dump() } + } else { + IME.prtDebugIntel("lmMisc: File access failure: \(path)") } } @@ -131,53 +137,70 @@ extension vChewing { if path.contains("vChewing/") { lmSymbols.dump() } + } else { + IME.prtDebugIntel("lmSymbols: File access failure: \(path)") } } public func loadUserPhrases(path: String, filterPath: String) { if FileManager.default.isReadableFile(atPath: path) { + lmUserPhrases.close() lmUserPhrases.open(path) IME.prtDebugIntel("lmUserPhrases: \(lmUserPhrases.count) entries of data loaded from: \(path)") if path.contains("vChewing/") { lmUserPhrases.dump() } + } else { + IME.prtDebugIntel("lmUserPhrases: File access failure: \(path)") } if FileManager.default.isReadableFile(atPath: filterPath) { + lmFiltered.close() lmFiltered.open(filterPath) IME.prtDebugIntel("lmFiltered: \(lmFiltered.count) entries of data loaded from: \(path)") if path.contains("vChewing/") { lmFiltered.dump() } + } else { + IME.prtDebugIntel("lmFiltered: File access failure: \(path)") } } public func loadUserSymbolData(path: String) { if FileManager.default.isReadableFile(atPath: path) { + lmUserSymbols.close() lmUserSymbols.open(path) IME.prtDebugIntel("lmUserSymbol: \(lmUserSymbols.count) entries of data loaded from: \(path)") if path.contains("vChewing/") { lmUserSymbols.dump() } + } else { + IME.prtDebugIntel("lmUserSymbol: File access failure: \(path)") } } public func loadUserAssociatedPhrases(path: String) { if FileManager.default.isReadableFile(atPath: path) { + lmAssociates.close() lmAssociates.open(path) IME.prtDebugIntel("lmAssociates: \(lmAssociates.count) entries of data loaded from: \(path)") if path.contains("vChewing/") { lmAssociates.dump() } + } else { + IME.prtDebugIntel("lmAssociates: File access failure: \(path)") } } public func loadPhraseReplacementMap(path: String) { if FileManager.default.isReadableFile(atPath: path) { + lmReplacements.close() lmReplacements.open(path) IME.prtDebugIntel("lmReplacements: \(lmReplacements.count) entries of data loaded from: \(path)") if path.contains("vChewing/") { lmReplacements.dump() } + } else { + IME.prtDebugIntel("lmReplacements: File access failure: \(path)") } } diff --git a/Source/Modules/LangModelRelated/SubLMs/lmLite.swift b/Source/Modules/LangModelRelated/SubLMs/lmLite.swift index 4a44b080..b3e8875c 100644 --- a/Source/Modules/LangModelRelated/SubLMs/lmLite.swift +++ b/Source/Modules/LangModelRelated/SubLMs/lmLite.swift @@ -46,7 +46,6 @@ extension vChewing { @discardableResult public mutating func open(_ path: String) -> Bool { if isLoaded() { - IME.prtDebugIntel("Not loading this one due to isLoaded result of true: \(path)") return false } diff --git a/Source/Modules/LangModelRelated/mgrLangModel.swift b/Source/Modules/LangModelRelated/mgrLangModel.swift index 8732a4fa..cfdf2dae 100644 --- a/Source/Modules/LangModelRelated/mgrLangModel.swift +++ b/Source/Modules/LangModelRelated/mgrLangModel.swift @@ -151,7 +151,7 @@ class mgrLangModel: NSObject { public static func loadUserPhrases() { gLangModelCHT.loadUserPhrases( - path: userSymbolDataPath(InputMode.imeModeCHT), + path: userPhrasesDataPath(InputMode.imeModeCHT), filterPath: excludedPhrasesDataPath(InputMode.imeModeCHT) ) gLangModelCHS.loadUserPhrases( @@ -166,7 +166,7 @@ class mgrLangModel: NSObject { gLangModelCHT.loadUserAssociatedPhrases( path: mgrLangModel.userAssociatedPhrasesDataPath(InputMode.imeModeCHT) ) - gLangModelCHT.loadUserAssociatedPhrases( + gLangModelCHS.loadUserAssociatedPhrases( path: mgrLangModel.userAssociatedPhrasesDataPath(InputMode.imeModeCHS) ) } @@ -175,7 +175,7 @@ class mgrLangModel: NSObject { gLangModelCHT.loadPhraseReplacementMap( path: mgrLangModel.phraseReplacementDataPath(InputMode.imeModeCHT) ) - gLangModelCHT.loadPhraseReplacementMap( + gLangModelCHS.loadPhraseReplacementMap( path: mgrLangModel.phraseReplacementDataPath(InputMode.imeModeCHS) ) }