diff --git a/Source/Modules/LangModelRelated/SubLMs/lmAssociates.swift b/Source/Modules/LangModelRelated/SubLMs/lmAssociates.swift index 10cd3df2..a17d1faf 100644 --- a/Source/Modules/LangModelRelated/SubLMs/lmAssociates.swift +++ b/Source/Modules/LangModelRelated/SubLMs/lmAssociates.swift @@ -102,6 +102,8 @@ extension vChewing { } public func valuesFor(pair: Megrez.KeyValuePaired) -> [String] { + var pairPinyin = pair + pairPinyin.key = Tekkon.cnvPhonaToHanyuPinyin(target: pairPinyin.key) var pairs: [String] = [] if let arrRangeRecords: [(Range, Int)] = rangeMap[pair.toNGramKey] { for (netaRange, index) in arrRangeRecords { @@ -110,6 +112,13 @@ extension vChewing { pairs.append(theValue) } } + if let arrRangeRecords: [(Range, Int)] = rangeMap[pairPinyin.toNGramKey] { + for (netaRange, index) in arrRangeRecords { + let neta = strData[netaRange].split(separator: " ") + let theValue: String = .init(neta[index]) + pairs.append(theValue) + } + } if let arrRangeRecords: [(Range, Int)] = rangeMap[pair.value] { for (netaRange, index) in arrRangeRecords { let neta = strData[netaRange].split(separator: " ")