From c97dd9c92e4657ab7da318a8ea584e7182225f0a Mon Sep 17 00:00:00 2001 From: ensan-hcl Date: Tue, 19 Sep 2023 23:44:57 +0900 Subject: [PATCH] Reorder candidates --- .../Converter/KanaKanjiConverter.swift | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Sources/KanaKanjiConverterModule/Converter/KanaKanjiConverter.swift b/Sources/KanaKanjiConverterModule/Converter/KanaKanjiConverter.swift index 4565cfd..de9e527 100644 --- a/Sources/KanaKanjiConverterModule/Converter/KanaKanjiConverter.swift +++ b/Sources/KanaKanjiConverterModule/Converter/KanaKanjiConverter.swift @@ -635,6 +635,9 @@ import SwiftUtils } emojiCandidates = self.getUniquePredictionCandidate(emojiCandidates, seenCandidates: seenCandidates) - return zeroHintResults.chained(predictionResults).chained(emojiCandidates.suffix(3)).max(count: 10, sortedBy: {$0.value < $1.value}) + var results: [PredictionCandidate] = [] + results.append(contentsOf: emojiCandidates.suffix(3)) + results.append(contentsOf: predictionResults.max(count: (10 - results.count) / 2, sortedBy: {$0.value < $1.value})) + results.append(contentsOf: zeroHintResults.max(count: 10 - results.count, sortedBy: {$0.value < $1.value})) } }