mirror of
https://github.com/mii443/AzooKeyKanaKanjiConverter.git
synced 2025-08-22 15:05:26 +00:00
Merge pull request #119 from ensan-hcl/fix/firstClauseResults
fix: firstClauseResultsとして得られる結果が長さではなくvalueでソートされる挙動を変更
This commit is contained in:
@ -512,7 +512,13 @@ import SwiftUtils
|
||||
// 重複のない変換候補を作成するための集合
|
||||
var seenCandidate: Set<String> = full_candidate.mapSet {$0.text}
|
||||
// 文節のみ変換するパターン(上位5件)
|
||||
let clause_candidates = self.getUniqueCandidate(clauseCandidates, seenCandidates: seenCandidate).min(count: 5, sortedBy: {$0.value > $1.value})
|
||||
let clause_candidates = self.getUniqueCandidate(clauseCandidates, seenCandidates: seenCandidate).min(count: 5) {
|
||||
if $0.correspondingCount == $1.correspondingCount {
|
||||
$0.value > $1.value
|
||||
} else {
|
||||
$0.correspondingCount > $1.correspondingCount
|
||||
}
|
||||
}
|
||||
seenCandidate.formUnion(clause_candidates.map {$0.text})
|
||||
|
||||
// 最初の辞書データ
|
||||
@ -566,7 +572,15 @@ import SwiftUtils
|
||||
item.withActions(self.getAppropriateActions(item))
|
||||
item.parseTemplate()
|
||||
}
|
||||
return ConversionResult(mainResults: result, firstClauseResults: Array(clause_candidates))
|
||||
// 文節のみ変換するパターン(上位5件)
|
||||
let firstClauseResults = self.getUniqueCandidate(clauseCandidates).min(count: 5) {
|
||||
if $0.correspondingCount == $1.correspondingCount {
|
||||
$0.value > $1.value
|
||||
} else {
|
||||
$0.correspondingCount > $1.correspondingCount
|
||||
}
|
||||
}
|
||||
return ConversionResult(mainResults: result, firstClauseResults: firstClauseResults)
|
||||
}
|
||||
|
||||
/// 入力からラティスを構築する関数。状況に応じて呼ぶ関数を分ける。
|
||||
|
Reference in New Issue
Block a user