Skip to content

Commit

Permalink
Fix max words to handling
Browse files Browse the repository at this point in the history
  • Loading branch information
Лев Кудряшов authored and Лев Кудряшов committed Nov 6, 2023
1 parent eb1c991 commit ef10d03
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion bread_bot/common/services/morph_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def _get_maximum_words_to_replace(cls, words_count: int, scale_factor: int) -> i
coefficient = 0.5 * scale_factor
else:
coefficient = 0.3 * scale_factor
return math.ceil(words_count * coefficient)
return max(words_count, math.ceil(words_count * coefficient))

async def _get_dictionary_words(self) -> dict[tuple, Any]:
entities = await DictionaryEntity.async_filter(self.db, DictionaryEntity.chat_id == self.chat_id)
Expand Down

0 comments on commit ef10d03

Please sign in to comment.