UOM // Save UOM data on observation.

This commit is contained in:
ShikiSuen 2022-06-22 23:12:25 +08:00
parent ede23aaca3
commit ab32cd9beb
1 changed files with 3 additions and 0 deletions

View File

@ -47,6 +47,7 @@ extension vChewing {
timestamp: Double timestamp: Double
) { ) {
let key = convertKeyFrom(walkedAnchors: walkedAnchors, cursorIndex: cursorIndex) let key = convertKeyFrom(walkedAnchors: walkedAnchors, cursorIndex: cursorIndex)
guard !key.isEmpty else { return }
guard mutLRUMap[key] != nil else { guard mutLRUMap[key] != nil else {
var observation: Observation = .init() var observation: Observation = .init()
@ -60,6 +61,7 @@ extension vChewing {
mutLRUList.removeLast() mutLRUList.removeLast()
} }
IME.prtDebugIntel("UOM: Observation finished with new observation: \(key)") IME.prtDebugIntel("UOM: Observation finished with new observation: \(key)")
mgrLangModel.saveUserOverrideModelData()
return return
} }
if var theNeta = mutLRUMap[key] { if var theNeta = mutLRUMap[key] {
@ -67,6 +69,7 @@ extension vChewing {
mutLRUList.insert(theNeta, at: 0) mutLRUList.insert(theNeta, at: 0)
mutLRUMap[key] = theNeta mutLRUMap[key] = theNeta
IME.prtDebugIntel("UOM: Observation finished with existing observation: \(key)") IME.prtDebugIntel("UOM: Observation finished with existing observation: \(key)")
mgrLangModel.saveUserOverrideModelData()
} }
} }