LMInstantiator // Fix a parameter name.

This commit is contained in:
ShikiSuen 2022-12-08 14:50:53 +08:00
parent 969977f09b
commit 1b86b1b609
2 changed files with 6 additions and 6 deletions

View File

@ -291,14 +291,14 @@ extension vChewingLM {
///
/// - Parameters:
/// - key:
/// - keyArray:
/// - value:
/// - factoryDictionaryOnly:
/// - Returns:
public func hasKeyValuePairFor(key: [String], value: String, factoryDictionaryOnly: Bool = false) -> Bool {
public func hasKeyValuePairFor(keyArray: [String], value: String, factoryDictionaryOnly: Bool = false) -> Bool {
factoryDictionaryOnly
? lmCore.unigramsFor(key: key.joined(separator: "-")).map(\.value).contains(value)
: unigramsFor(keyArray: key).map(\.value).contains(value)
? lmCore.unigramsFor(key: keyArray.joined(separator: "-")).map(\.value).contains(value)
: unigramsFor(keyArray: keyArray).map(\.value).contains(value)
}
/// LMI

View File

@ -279,8 +279,8 @@ public class LMMgr {
key unigramKey: String
) -> Bool {
switch mode {
case .imeModeCHS: return lmCHS.hasKeyValuePairFor(key: [unigramKey], value: userPhrase)
case .imeModeCHT: return lmCHT.hasKeyValuePairFor(key: [unigramKey], value: userPhrase)
case .imeModeCHS: return lmCHS.hasKeyValuePairFor(keyArray: [unigramKey], value: userPhrase)
case .imeModeCHT: return lmCHT.hasKeyValuePairFor(keyArray: [unigramKey], value: userPhrase)
case .imeModeNULL: return false
}
}