mirror of
https://github.com/mii443/AzooKeyKanaKanjiConverter.git
synced 2025-12-03 02:58:27 +00:00
lint
This commit is contained in:
@@ -36,7 +36,7 @@ public enum CIDData: Sendable {
|
||||
case .EOS: return 1316
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static func isJoshi(cid: Int) -> Bool {
|
||||
return 147 <= cid && cid <= 368
|
||||
}
|
||||
|
||||
@@ -10,4 +10,4 @@ public struct ConversionResult: Sendable {
|
||||
public var mainResults: [Candidate]
|
||||
/// 変換候補のうち最初の文節を変換したもの
|
||||
public var firstClauseResults: [Candidate]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -144,7 +144,6 @@ import SwiftUtils
|
||||
return result
|
||||
}
|
||||
|
||||
|
||||
/// 外国語への予測変換候補を生成する関数
|
||||
/// - Parameters:
|
||||
/// - inputData: 変換対象のデータ。
|
||||
@@ -622,7 +621,7 @@ import SwiftUtils
|
||||
|
||||
return self.processResult(inputData: inputData, result: result, options: options)
|
||||
}
|
||||
|
||||
|
||||
/// 変換確定後の予測変換候補を要求する関数
|
||||
public func requestPredictionCandidates(leftSideCandidate: Candidate, options: ConvertRequestOptions) -> [PredictionCandidate] {
|
||||
// ゼロヒント予測変換に基づく候補を列挙
|
||||
@@ -646,7 +645,7 @@ import SwiftUtils
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 予測変換に基づく候補を列挙
|
||||
let predictionResults = self.converter.getPredictionCandidates(prepart: leftSideCandidate, N_best: 15)
|
||||
// 絵文字を追加
|
||||
@@ -659,16 +658,16 @@ import SwiftUtils
|
||||
}
|
||||
}
|
||||
emojiCandidates = self.getUniquePredictionCandidate(emojiCandidates)
|
||||
|
||||
|
||||
var results: [PredictionCandidate] = []
|
||||
var seenCandidates: Set<String> = []
|
||||
|
||||
results.append(contentsOf: emojiCandidates.suffix(3))
|
||||
seenCandidates.formUnion(emojiCandidates.suffix(3).map{$0.text})
|
||||
seenCandidates.formUnion(emojiCandidates.suffix(3).map {$0.text})
|
||||
|
||||
let predictions = self.getUniquePredictionCandidate(predictionResults, seenCandidates: seenCandidates).min(count: (10 - results.count) / 2, sortedBy: {$0.value > $1.value})
|
||||
results.append(contentsOf: predictions)
|
||||
seenCandidates.formUnion(predictions.map{$0.text})
|
||||
seenCandidates.formUnion(predictions.map {$0.text})
|
||||
|
||||
let zeroHints = self.getUniquePredictionCandidate(zeroHintResults, seenCandidates: seenCandidates)
|
||||
results.append(contentsOf: zeroHints.min(count: 10 - results.count, sortedBy: {$0.value > $1.value}))
|
||||
|
||||
@@ -54,19 +54,18 @@ extension Kana2Kanji {
|
||||
prefixCandidate.value -= self.dicdataStore.getMMValue(previousMid, element.mid)
|
||||
}
|
||||
prefixCandidate.data = prefixCandidateData
|
||||
|
||||
|
||||
prefixCandidate.text = prefixCandidateData.reduce(into: "") { $0 += $1.word }
|
||||
prefixCandidate.correspondingCount = prefixCandidateData.reduce(into: 0) { $0 += $1.ruby.count }
|
||||
}
|
||||
|
||||
|
||||
totalWord.insert(contentsOf: element.word, at: totalWord.startIndex)
|
||||
totalRuby.insert(contentsOf: element.ruby, at: totalRuby.startIndex)
|
||||
totalData.insert(element, at: 0)
|
||||
let dicdata = self.dicdataStore.getPredictionLOUDSDicdata(key: totalRuby).filter {
|
||||
DicdataStore.predictionUsable[$0.rcid] && $0.word.hasPrefix(totalWord)
|
||||
}
|
||||
|
||||
|
||||
for data in dicdata {
|
||||
let ccValue = self.dicdataStore.getCCValue(prefixCandidateData.last?.rcid ?? CIDData.BOS.cid, data.lcid)
|
||||
let includeMMValueCalculation = DicdataStore.includeMMValueCalculation(data)
|
||||
|
||||
@@ -18,7 +18,7 @@ public struct PredictionCandidate {
|
||||
self.isTerminal = false
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public var text: String
|
||||
public var value: PValue
|
||||
public var type: PredictionType
|
||||
|
||||
Reference in New Issue
Block a user