KeyHandler // Re-enable UOM.

This commit is contained in:
ShikiSuen 2022-06-21 00:33:17 +08:00
parent 465d0a9845
commit 7754a29925
2 changed files with 32 additions and 32 deletions

View File

@ -170,37 +170,37 @@ class KeyHandler {
func fixNode(value: String, respectCursorPushing: Bool = true) {
let cursorIndex = min(actualCandidateCursorIndex + (mgrPrefs.useRearCursorMode ? 1 : 0), compositorLength)
compositor.grid.fixNodeSelectedCandidate(location: cursorIndex, value: value)
// //
// let selectedNode: Megrez.NodeAnchor = compositor.grid.fixNodeSelectedCandidate(
// location: cursorIndex, value: value
// )
// //
// if !mgrPrefs.useSCPCTypingMode {
// //
// var addToUserOverrideModel = true
// if selectedNode.spanningLength != value.count {
// IME.prtDebugIntel("UOM: SpanningLength != value.count, dismissing.")
// addToUserOverrideModel = false
// }
// if addToUserOverrideModel {
// if let theNode = selectedNode.node {
// // SymbolLM Score -12
// if theNode.scoreFor(candidate: value) <= -12 {
// IME.prtDebugIntel("UOM: Score <= -12, dismissing.")
// addToUserOverrideModel = false
// }
// }
// }
// if addToUserOverrideModel {
// IME.prtDebugIntel("UOM: Start Observation.")
// // trigram
// // trigram
// currentUOM.observe(
// walkedAnchors: walkedAnchors, cursorIndex: cursorIndex, candidate: value,
// timestamp: NSDate().timeIntervalSince1970
// )
// }
// }
//
let selectedNode: Megrez.NodeAnchor = compositor.grid.fixNodeSelectedCandidate(
location: cursorIndex, value: value
)
//
if !mgrPrefs.useSCPCTypingMode {
//
var addToUserOverrideModel = true
if selectedNode.spanningLength != value.count {
IME.prtDebugIntel("UOM: SpanningLength != value.count, dismissing.")
addToUserOverrideModel = false
}
if addToUserOverrideModel {
if let theNode = selectedNode.node {
// SymbolLM Score -12
if theNode.scoreFor(candidate: value) <= -12 {
IME.prtDebugIntel("UOM: Score <= -12, dismissing.")
addToUserOverrideModel = false
}
}
}
if addToUserOverrideModel {
IME.prtDebugIntel("UOM: Start Observation.")
// trigram
// trigram
currentUOM.observe(
walkedAnchors: walkedAnchors, cursorIndex: cursorIndex, candidate: value,
timestamp: NSDate().timeIntervalSince1970
)
}
}
walk()
///

View File

@ -195,7 +195,7 @@ extension KeyHandler {
let textToCommit = popOverflowComposingTextAndWalk
//
// dealWithOverrideModelSuggestions() // 使
dealWithOverrideModelSuggestions()
//
markNodesFixedIfNecessary()