SubLMs // Simplify (has)values/unigramsFor().

This commit is contained in:
ShikiSuen 2022-05-02 10:46:07 +08:00
parent b8bb5e18d6
commit 28889dc717
4 changed files with 4 additions and 17 deletions

View File

@ -115,10 +115,7 @@ extension vChewing {
}
public func hasValuesFor(key: String) -> Bool {
if let arrEntry = keyValueMap[key] {
return !arrEntry.isEmpty
}
return false
keyValueMap[key] != nil
}
}
}

View File

@ -159,10 +159,7 @@ extension vChewing {
}
open func hasUnigramsFor(key: String) -> Bool {
if let arrEntry = keyValueScoreMap[key] {
return !arrEntry.isEmpty
}
return false
keyValueScoreMap[key] != nil
}
}
}

View File

@ -136,10 +136,7 @@ extension vChewing {
}
public func hasUnigramsFor(key: String) -> Bool {
if let arrEntry = keyValueMap[key] {
return !arrEntry.isEmpty
}
return false
keyValueMap[key] != nil
}
}
}

View File

@ -105,11 +105,7 @@ extension vChewing {
}
public func valuesFor(key: String) -> String {
var v = ""
if let matched = keyValueMap[key] {
v = matched
}
return v
keyValueMap[key] ?? ""
}
}
}