Skip to content

Conversation

Dunedan
Copy link
Collaborator

@Dunedan Dunedan commented Mar 18, 2025

If text being scanned for profanity couldn't be associated with complete certainty to a single language, we add English as fallback language to the list of detected languages. However, if the detected language was English as well, we did end up with storing "en" twice for the detected languages. This commit fixes that, so "en" is only stored once. While using a set for removing duplicates would've been the most natural solution, we can't use that, as we need to preserve the order of languages. Therefore dict.fromkeys() is used instead.

If text being scanned for profanity couldn't be associated with complete
certainty to a single language, we add English as fallback language to
the list of detected languages. However, if the detected language was
English as well, we did end up with storing "en" twice for the detected
languages. This commit fixes that, so "en" is only stored once. While
using a set for removing duplicates would've been the most natural
solution, we can't use that, as we need to preserve the order of
languages. Therefore dict.fromkeys() is used instead.
@Dunedan Dunedan merged commit d7fd823 into 0ad:master May 18, 2025
4 checks passed
@Dunedan Dunedan deleted the fix-storing-en-twice-as-language branch May 18, 2025 05:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant