Partial language understanding actually works as intended (#93999)

## About The Pull Request

So, partial language understanding scaled the % chance to translate
something based on the ranking in the most common words list

But the ranking isn't real the list is in alphabetical order

So, adds a new list of the 1000 most common words sorted by *frequency*,
which I found on a random github page.
Is it scientifically found? I have no idea, but it looks good enough to
work.

This list doesn't share the same 1000 words as our existing one, so I
added all the differing words (amounted to ~400) to the original list.

So now partial language understanding correctly translates words based
on frequency.

## Changelog

🆑 Melbert
fix: Partial language understanding now correctly has a higher chance of
translating more common words.
qol: Aphasia got slightly more words to work with 
/🆑
This commit is contained in:
MrMelbert
2025-11-18 17:26:19 -07:00
committed by GitHub
parent 3d8b719db7
commit b62ee3c6a9
6 changed files with 1399 additions and 23 deletions
+2 -2
View File
@@ -195,7 +195,7 @@
SHOULD_NOT_OVERRIDE(TRUE)
var/lowertext_input = LOWER_TEXT(input)
// The most common words are always cached
if(GLOB.most_common_words[lowertext_input])
if(GLOB.most_common_words_frequency[lowertext_input])
most_common_cache[lowertext_input] = scrambled_text
return
// Add it to cache, cutting old entries if the list is too long
@@ -263,7 +263,7 @@
if(translate_prob > 0)
// the probability of managing to understand a word is based on how common it is (+10%, -15%)
// 1000 words in the list, so words outside the list are just treated as "the 1250th most common word"
var/commonness = GLOB.most_common_words[LOWER_TEXT(base_word)] || 1250
var/commonness = GLOB.most_common_words_frequency[LOWER_TEXT(base_word)] || 1250
translate_prob += (10 * (1 - (min(commonness, 1250) / 500)))
if(prob(translate_prob))
scrambled_words += word