[Userscript] ConfusionGuesser

Version 1.2 patch-notes:

WaniKani's hidden whitelist can now be considered for guesses (deactivated by default)

Some WK items have additional meanings in a hidden whitelist. For example 矛 was once translated as “halberd” which is still in the whitelist. This also applies to the radical names that were changed in the big overhaul - 廴 for example still has “big bird” whitelisted. ConfusionGuesser can now guess 殳 if you somewhere wrongly answer with “ikea”, and also show you what the thing is that Koichi likes so much that he had named three radicals after it:

Your own added synonyms can now be considered for guesses (deactivated by default)

WK allows users to enter their own synonyms. ConfusionGuesser can now base guesses on these user synonyms.

Adaptions to mapping of reading to kanji

examples: 挿絵 - さし|え instead of さ|しえ; 巻尺 - まき|じゃく instead of ま|きじゃく

  • until now the mapping was prioritized from left to right; for vocab where okurigana was “pulled into the kanji”, this led to wrong mappings
    example: 挿絵 was split up さ|しえ - 挿 has kun’yomi さ, and しえ was assumed to be a special reading for 絵
    changed so that it now prioritizes shorter matches on the right:
    挿絵 is now split up さし|え - 絵 has on’yomi え, and さし is assumed to be a special reading for 挿
Adaptions to similarity rating
  • increased rating if two consecutive kanji are swapped
    example 1: 栄光 and 光栄 are now rated 0.85 instead of 0.5
    example 2: 過疎 and 疎開 are now rated 0.4 instead of 0.1
    Reason for this change: I wanted 疎開 to win against 避難 in their similarity to 過疎
  • manually defined two component pairs as equal (IDS similarity)
    囗 is defined equal to 口
    厶 is defined equal to ム
    example: 公 and ム now have IDS similarity 0.38 instead of 0.1 (minimum similarity)
Prevent removal of important guesses that happened in rare cases

example: until now, when answering with へいじ for 幽閉, no top guess for the wrong じ was displayed; it would have been 閉, but 閉 was already a guess for へい with an equally high rating, and duplicate guesses are deleted

If I broke something please let me know.
Link to previous script version for downgrading in case version 1.2 doesn’t work for you