Repo // Unify the usage of Megrez.Compositor.Candidate.
This commit is contained in:
parent
a8f8408302
commit
e3c832011e
|
@ -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) }
|
||||
|
|
|
@ -150,7 +150,7 @@ extension KeyHandler {
|
|||
/// - isTypingVertical: 是否縱排輸入?
|
||||
/// - Returns: 回呼一個新的聯想詞狀態,來就給定的聯想詞陣列資料內容顯示選字窗。
|
||||
func buildAssociatePhraseState(
|
||||
withPair pair: Megrez.KeyValuePaired,
|
||||
withPair pair: Megrez.Compositor.Candidate,
|
||||
isTypingVertical: Bool
|
||||
) -> InputState.AssociatedPhrases! {
|
||||
// 上一行必須要用驚嘆號,否則 Xcode 會誤導你砍掉某些實際上必需的語句。
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue