mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-06-28 11:49:56 +00:00
get all suggestions without coroutines
This commit is contained in:
parent
deec4d1f98
commit
0a9c9fdab8
1 changed files with 2 additions and 4 deletions
|
@ -469,18 +469,16 @@ class DictionaryFacilitatorImpl : DictionaryFacilitator {
|
||||||
val proximityInfoHandle = keyboard.proximityInfo.nativeProximityInfo
|
val proximityInfoHandle = keyboard.proximityInfo.nativeProximityInfo
|
||||||
val weightOfLangModelVsSpatialModel = floatArrayOf(Dictionary.NOT_A_WEIGHT_OF_LANG_MODEL_VS_SPATIAL_MODEL)
|
val weightOfLangModelVsSpatialModel = floatArrayOf(Dictionary.NOT_A_WEIGHT_OF_LANG_MODEL_VS_SPATIAL_MODEL)
|
||||||
|
|
||||||
val deferredSuggestions = dictionaryGroups.map {
|
val suggestions = dictionaryGroups.map {
|
||||||
scope.async {
|
|
||||||
// todo: if the order does not matter, we could add the suggestions right away without awaitAll first
|
// todo: if the order does not matter, we could add the suggestions right away without awaitAll first
|
||||||
getSuggestions(composedData, ngramContext, settingsValuesForSuggestion, sessionId,
|
getSuggestions(composedData, ngramContext, settingsValuesForSuggestion, sessionId,
|
||||||
proximityInfoHandle, weightOfLangModelVsSpatialModel, it)
|
proximityInfoHandle, weightOfLangModelVsSpatialModel, it)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
val suggestionResults = SuggestionResults(
|
val suggestionResults = SuggestionResults(
|
||||||
SuggestedWords.MAX_SUGGESTIONS, ngramContext.isBeginningOfSentenceContext,
|
SuggestedWords.MAX_SUGGESTIONS, ngramContext.isBeginningOfSentenceContext,
|
||||||
false
|
false
|
||||||
)
|
)
|
||||||
runBlocking { deferredSuggestions.awaitAll() }.forEach {
|
suggestions.forEach {
|
||||||
suggestionResults.addAll(it)
|
suggestionResults.addAll(it)
|
||||||
suggestionResults.mRawSuggestions?.addAll(it)
|
suggestionResults.mRawSuggestions?.addAll(it)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue