LMs // Clang-format.
This commit is contained in:
parent
c49020097e
commit
2f4c993e3f
|
@ -44,7 +44,7 @@ extension vChewing {
|
|||
!keyValueMap.isEmpty
|
||||
}
|
||||
|
||||
@discardableResult mutating public func open(_ path: String) -> Bool {
|
||||
@discardableResult public mutating func open(_ path: String) -> Bool {
|
||||
if isLoaded() {
|
||||
return false
|
||||
}
|
||||
|
@ -91,12 +91,12 @@ extension vChewing {
|
|||
keyValueMap[currentKV.key, default: []].append(currentKV)
|
||||
}
|
||||
}
|
||||
IME.prtDebugIntel("\(self.keyValueMap.count) entries of data loaded from: \(path)")
|
||||
IME.prtDebugIntel("\(keyValueMap.count) entries of data loaded from: \(path)")
|
||||
theData = ""
|
||||
return true
|
||||
}
|
||||
|
||||
mutating public func close() {
|
||||
public mutating func close() {
|
||||
if isLoaded() {
|
||||
keyValueMap.removeAll()
|
||||
}
|
||||
|
|
|
@ -55,7 +55,7 @@ extension vChewing {
|
|||
!keyValueScoreMap.isEmpty
|
||||
}
|
||||
|
||||
@discardableResult mutating public func open(_ path: String) -> Bool {
|
||||
@discardableResult public mutating func open(_ path: String) -> Bool {
|
||||
if isLoaded() {
|
||||
return false
|
||||
}
|
||||
|
@ -92,7 +92,7 @@ extension vChewing {
|
|||
}
|
||||
continue
|
||||
}
|
||||
var currentUnigram = Megrez.Unigram(keyValue: Megrez.KeyValuePair(), score: self.defaultScore)
|
||||
var currentUnigram = Megrez.Unigram(keyValue: Megrez.KeyValuePair(), score: defaultScore)
|
||||
var columnOne = ""
|
||||
var columnTwo = ""
|
||||
for (unitID, unitContent) in lineContent.components(separatedBy: " ").enumerated() {
|
||||
|
@ -102,7 +102,7 @@ extension vChewing {
|
|||
case 1:
|
||||
columnTwo = unitContent
|
||||
case 2:
|
||||
if !self.shouldForceDefaultScore {
|
||||
if !shouldForceDefaultScore {
|
||||
if let unitContentConverted = Double(unitContent) {
|
||||
currentUnigram.score = unitContentConverted
|
||||
} else {
|
||||
|
@ -117,20 +117,20 @@ extension vChewing {
|
|||
currentUnigram.score -= (Double(lineID) * 0.000001)
|
||||
}
|
||||
let kvPair =
|
||||
self.shouldReverse
|
||||
shouldReverse
|
||||
? Megrez.KeyValuePair(key: columnTwo, value: columnOne)
|
||||
: Megrez.KeyValuePair(key: columnOne, value: columnTwo)
|
||||
currentUnigram.keyValue = kvPair
|
||||
let key = self.shouldReverse ? columnTwo : columnOne
|
||||
self.keyValueScoreMap[key, default: []].append(currentUnigram)
|
||||
let key = shouldReverse ? columnTwo : columnOne
|
||||
keyValueScoreMap[key, default: []].append(currentUnigram)
|
||||
}
|
||||
}
|
||||
IME.prtDebugIntel("\(self.keyValueScoreMap.count) entries of data loaded from: \(path)")
|
||||
IME.prtDebugIntel("\(keyValueScoreMap.count) entries of data loaded from: \(path)")
|
||||
theData = ""
|
||||
return true
|
||||
}
|
||||
|
||||
mutating public func close() {
|
||||
public mutating func close() {
|
||||
if isLoaded() {
|
||||
keyValueScoreMap.removeAll()
|
||||
}
|
||||
|
|
|
@ -46,7 +46,7 @@ extension vChewing {
|
|||
!keyValueMap.isEmpty
|
||||
}
|
||||
|
||||
@discardableResult mutating public func open(_ path: String) -> Bool {
|
||||
@discardableResult public mutating func open(_ path: String) -> Bool {
|
||||
if isLoaded() {
|
||||
return false
|
||||
}
|
||||
|
@ -95,7 +95,7 @@ extension vChewing {
|
|||
keyValueMap[currentKV.key, default: []].append(currentKV)
|
||||
}
|
||||
}
|
||||
IME.prtDebugIntel("\(self.keyValueMap.count) entries of data loaded from: \(path)")
|
||||
IME.prtDebugIntel("\(keyValueMap.count) entries of data loaded from: \(path)")
|
||||
theData = ""
|
||||
if path.contains("vChewing/") {
|
||||
dump()
|
||||
|
@ -103,7 +103,7 @@ extension vChewing {
|
|||
return true
|
||||
}
|
||||
|
||||
mutating public func close() {
|
||||
public mutating func close() {
|
||||
if isLoaded() {
|
||||
keyValueMap.removeAll()
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@ extension vChewing {
|
|||
!keyValueMap.isEmpty
|
||||
}
|
||||
|
||||
@discardableResult mutating public func open(_ path: String) -> Bool {
|
||||
@discardableResult public mutating func open(_ path: String) -> Bool {
|
||||
if isLoaded() {
|
||||
return false
|
||||
}
|
||||
|
@ -91,12 +91,12 @@ extension vChewing {
|
|||
keyValueMap[currentKV.key] = currentKV.value
|
||||
}
|
||||
}
|
||||
IME.prtDebugIntel("\(self.keyValueMap.count) entries of data loaded from: \(path)")
|
||||
IME.prtDebugIntel("\(keyValueMap.count) entries of data loaded from: \(path)")
|
||||
theData = ""
|
||||
return true
|
||||
}
|
||||
|
||||
mutating public func close() {
|
||||
public mutating func close() {
|
||||
if isLoaded() {
|
||||
keyValueMap.removeAll()
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue