Repo // Unify the usage of Megrez.Compositor.Candidate.

This commit is contained in:
ShikiSuen 2022-08-29 16:50:40 +08:00
parent a8f8408302
commit e3c832011e
5 changed files with 8 additions and 8 deletions

View File

@ -122,7 +122,7 @@ public class KeyHandler {
/// - Parameter key:
/// - Returns:
/// nil
func buildAssociatePhraseArray(withPair pair: Megrez.KeyValuePaired) -> [(String, String)] {
func buildAssociatePhraseArray(withPair pair: Megrez.Compositor.Candidate) -> [(String, String)] {
var arrResult: [(String, String)] = []
if currentLM.hasAssociatedPhrasesFor(pair: pair) {
arrResult = currentLM.associatedPhrasesFor(pair: pair).map { ("", $0) }

View File

@ -150,7 +150,7 @@ extension KeyHandler {
/// - isTypingVertical:
/// - Returns:
func buildAssociatePhraseState(
withPair pair: Megrez.KeyValuePaired,
withPair pair: Megrez.Compositor.Candidate,
isTypingVertical: Bool
) -> InputState.AssociatedPhrases! {
//  Xcode

View File

@ -245,11 +245,11 @@ extension vChewing {
return !unigramsFor(key: key).isEmpty
}
public func associatedPhrasesFor(pair: Megrez.KeyValuePaired) -> [String] {
public func associatedPhrasesFor(pair: Megrez.Compositor.Candidate) -> [String] {
lmAssociates.valuesFor(pair: pair)
}
public func hasAssociatedPhrasesFor(pair: Megrez.KeyValuePaired) -> Bool {
public func hasAssociatedPhrasesFor(pair: Megrez.Compositor.Candidate) -> Bool {
lmAssociates.hasValuesFor(pair: pair)
}

View File

@ -78,7 +78,7 @@ extension vChewing {
// This function will be implemented only if further hard-necessity comes.
}
public func valuesFor(pair: Megrez.KeyValuePaired) -> [String] {
public func valuesFor(pair: Megrez.Compositor.Candidate) -> [String] {
var pairs: [String] = []
if let arrRangeRecords: [(Range<String.Index>, Int)] = rangeMap[pair.toNGramKey] {
for (netaRange, index) in arrRangeRecords {
@ -98,7 +98,7 @@ extension vChewing {
return pairs.filter { set.insert($0).inserted }
}
public func hasValuesFor(pair: Megrez.KeyValuePaired) -> Bool {
public func hasValuesFor(pair: Megrez.Compositor.Candidate) -> Bool {
if rangeMap[pair.toNGramKey] != nil { return true }
return rangeMap[pair.value] != nil
}

View File

@ -319,8 +319,8 @@ extension vChewing.LMUserOverride {
//
let strCurrent = kvCurrent.key
var kvPrevious = Megrez.KeyValuePaired()
var kvAnterior = Megrez.KeyValuePaired()
var kvPrevious = Megrez.Compositor.Candidate()
var kvAnterior = Megrez.Compositor.Candidate()
var readingStack = ""
var trigramKey: String { "(\(kvAnterior.toNGramKey),\(kvPrevious.toNGramKey),\(strCurrent))" }
var result: String {