Repo // walkedNodes -> walkedAnchors.

This commit is contained in:
ShikiSuen 2022-06-20 23:21:12 +08:00
parent 067ceebf71
commit 465d0a9845
2 changed files with 8 additions and 8 deletions

View File

@ -196,7 +196,7 @@ class KeyHandler {
// // trigram // // trigram
// // trigram // // trigram
// currentUOM.observe( // currentUOM.observe(
// walkedNodes: walkedAnchors, cursorIndex: cursorIndex, candidate: value, // walkedAnchors: walkedAnchors, cursorIndex: cursorIndex, candidate: value,
// timestamp: NSDate().timeIntervalSince1970 // timestamp: NSDate().timeIntervalSince1970
// ) // )
// } // }
@ -268,7 +268,7 @@ class KeyHandler {
mgrPrefs.useSCPCTypingMode mgrPrefs.useSCPCTypingMode
? "" ? ""
: currentUOM.suggest( : currentUOM.suggest(
walkedNodes: walkedAnchors, cursorIndex: compositorCursorIndex, walkedAnchors: walkedAnchors, cursorIndex: compositorCursorIndex,
timestamp: NSDate().timeIntervalSince1970 timestamp: NSDate().timeIntervalSince1970
) )

View File

@ -78,12 +78,12 @@ extension vChewing {
} }
public func observe( public func observe(
walkedNodes: [Megrez.NodeAnchor], walkedAnchors: [Megrez.NodeAnchor],
cursorIndex: Int, cursorIndex: Int,
candidate: String, candidate: String,
timestamp: Double timestamp: Double
) { ) {
let key = convertKeyFrom(walkedNodes: walkedNodes, cursorIndex: cursorIndex) let key = convertKeyFrom(walkedAnchors: walkedAnchors, cursorIndex: cursorIndex)
guard mutLRUMap[key] != nil else { guard mutLRUMap[key] != nil else {
let observation: Observation = .init() let observation: Observation = .init()
@ -108,11 +108,11 @@ extension vChewing {
} }
public func suggest( public func suggest(
walkedNodes: [Megrez.NodeAnchor], walkedAnchors: [Megrez.NodeAnchor],
cursorIndex: Int, cursorIndex: Int,
timestamp: Double timestamp: Double
) -> String { ) -> String {
let key = convertKeyFrom(walkedNodes: walkedNodes, cursorIndex: cursorIndex) let key = convertKeyFrom(walkedAnchors: walkedAnchors, cursorIndex: cursorIndex)
guard let koPair = mutLRUMap[key] else { guard let koPair = mutLRUMap[key] else {
IME.prtDebugIntel("UOM: mutLRUMap[key] is nil, throwing blank suggestion for key: \(key).") IME.prtDebugIntel("UOM: mutLRUMap[key] is nil, throwing blank suggestion for key: \(key).")
return "" return ""
@ -161,12 +161,12 @@ extension vChewing {
} }
func convertKeyFrom( func convertKeyFrom(
walkedNodes: [Megrez.NodeAnchor], cursorIndex: Int walkedAnchors: [Megrez.NodeAnchor], cursorIndex: Int
) -> String { ) -> String {
let arrEndingPunctuation = ["", "", "", "", "", "", "", ""] let arrEndingPunctuation = ["", "", "", "", "", "", "", ""]
var arrNodes: [Megrez.NodeAnchor] = [] var arrNodes: [Megrez.NodeAnchor] = []
var intLength = 0 var intLength = 0
for theNodeAnchor in walkedNodes { for theNodeAnchor in walkedAnchors {
arrNodes.append(theNodeAnchor) arrNodes.append(theNodeAnchor)
intLength += theNodeAnchor.spanningLength intLength += theNodeAnchor.spanningLength
if intLength >= cursorIndex { if intLength >= cursorIndex {