[Userscript] ConfusionGuesser

Thanks for all the nice comments! :slight_smile:
I’m glad that so many of you think that my script might be useful.

I assume you mean transitive/intransitive errors that occur at meaning questions? I have not implemented anything specifically for this case, but if you for example write “to be wet” (intransitive) when asked for the meaning of 湿らせる (transitive), then my script will display items with the meaning that you have entered:


I think in most cases, the other half of the transitive/intransitive pair should be ranked at the top. I could probably try to mark this as a new guess type “intransitive⬄transitive” instead of the default “丸⬄九”, but I don’t know if I can do this accurately enough.

I’m a bit surprised that in your guesses list the vertical scrollbar is not displayed. When I tested my script on Firefox, it added weird line breaks into guesses unless I set the scrollbar to be always visible:
Line%20break
Therefore I tried to make it so that on Firefox the scrollbar is forced to be visible, even if there is nothing to scroll. It seems like it didn’t work, so I hope that you don’t get those ugly line breaks. However, now that I think about it, maybe the superfluous scrollbar is even uglier than the line breaks.
Does anyone with css experience know how I could fix this? Firefox seems to first calculate the necessary width for the div with the css-grid so that everything fits nicely, but afterwards realizes that it needs to draw a vertical scrollbar. It then takes the needed space from the grid away, which results in the grid width shrinking. Some text does not fit anymore and line breaks are added. Google Chrome on the other hand makes the div a bit wider whenever it needs to draw the scrollbar, so no line breaks appear. Or maybe this happens exclusively in the Firefox Developer Edition that I have used for testing.

Sorry, I can’t help you with that. But everyone who wants can use my code for whatever they want. I also don’t care if I’m credited or not. Just don’t take my code and then accuse me of stealing it from you. So any app developers are free to add this functionality to their app. However, I don’t know if any of my code would be useful for something like that. I know nothing about app development - they probably don’t even use javascript(?), and I also doubt that my javascript code is of high quality, since I just started using javascript this year.

7 Likes

I use Firefox Quantum, not the developer version. There’s a vertical scrollbar at the right if I hover my cursor at the right.

Recent screenshots.

2 Likes

It’s a sad world :joy:

1 Like

Is there a way to tell if IDS is successfully activated?

You can test it in the following way:

  1. Start a review session (WaniKani — Log in)
  2. In the ConfusionGuesser settings in the tab “Interface”, activate “Show ratings”
    2a. You might also need to disable “Guess only learned items” in the tab “Functionality”
  3. Open the console of your webbrowser (Ctrl+Shift+I), paste the following code into it, and press the enter key in the console:
$.jStorage.set("questionType", "meaning");
$.jStorage.set("currentItem", {kan: "歹"});
document.getElementById("user-response").value = "evening";
document.querySelector("#answer-form fieldset").classList.add("incorrect");

The first two lines pretend that you are currently reviewing the kanji 歹, the third line gives the answer “evening” (which is wrong, as that would be 夕), and the fourth line triggers my userscript to provide guesses. If it successfully uses the ideographic description sequences, the top guess should be 夕 with a similarity rating of 0.5. If it didn’t use the IDS, then it is only rated with 0.1, which I’ve set as the minimum for kanji similarity.


Afterwards, you should close or refresh this tab.

Why were you asking? Did you get strange results after activating the usage of IDS?

3 Likes

@Sinyaven Do you mind if I add your script to the API thread? Many users are directed there for an index of many of the best and most popular scripts. Afaik, yours isn’t there, and I’m sure a lot of users are missing out (or will be, once this thread disappears into the ether).

4 Likes

Oh yes, please add it :slight_smile:
I had forgotten that this thread exists. Thanks for checking if my script is in there. I guess I could also add it myself, but the list seems overwhelmingly long, so it would probably take me some time to find the place where it belongs.

4 Likes

My pleasure. I had to disconnect your name (@ Sinyaven) in the mentions because there’s some bug going on with the 10 mention limit. The thread is easier to navigate when you find the table of contents (albeit well hidden).

The worst part is having to scroll to the bottom to find the edit button :rofl:

3 Likes

It’s not a bug, so sadly we have to do that with the wikis. There’s a list at the top of that post (only visible in the editor) which details which users have the most entries in the list, so we mention only the 10 most frequent users.

Yeah, if you can think of a better way to display the ToC that would be great

You can also click the edit history button first, and then there’s a more accessible edit button in that popup.

1 Like

I literally forgot to download this last time, and only started using this now. It is absolutely amazing. It just tackled like three of my big leeches in the first few minutes. 10/10

1 Like

And here I thought you didn’t like it since I couldn’t find it in the list of your userscripts that you have posted in your level 60 post XD
I hope that it is helpful to you :slight_smile: Even if the IDS-based kanji similarity rating is still pretty bad. I should probably think up a better algorithm when I get time.

2 Likes

The answer I was confusing it with has so far always been in the list, so it’s perfect still :slight_smile:
Sorry I caused you to think I didn’t like it :cold_sweat:

EDIT: Gave you some much deserved publicity boost. :yum:

2 Likes

I’m just surprised the 10 user limit isn’t disabled for Wiki’s. That’s a pretty glaring oversight on Discourse’s part it seems. Thanks for the tips. I’ll have a think on the ToC.

1 Like

I’m wondering :thinking:
Can this script not suggest the same thing I had typed? This case is for a kanji that has more than one reading.

For example, this one, can I have “goku” as the suggestion instead of “kyoku” because that’s the same thing as I typed.

The guesses are not suggestions - the script tries to display the WK item that led you to giving this answer. In this case, you thought of 極 with the きょく reading, so this is what you are shown.

In addition to this reasoning, I also think きょく is more informative than ごく would be here: it tells you that きょく was indeed a valid reading for 極. ごく on the other hand would just duplicate the information already available through WaniKani’s Item Info button, where it shows you that the correct vocab reading would have been ごくらく.

And last but not least, it might also be more fun to not immediately get the correct answer displayed. When you see on⬄on きょく, you realize that you have thought of the wrong on’yomi and then might recall the correct reading for this vocab on your own, leaving you with some sense of accomplishment even though you failed the review.

3 Likes

Loving it so far but any chance you can add a font size setting? I often do my reviews from across a room, certainly no way I can read them. While I’m certainly willing to change my behavior, others have difficulty with their eyes and font size options can be a godsend.

I have added a dropdown menu in the settings dialog to choose a font size (script version 1.1). I hope these presets are good enough - if not please let me know.

1 Like

They work well for me, thanks a lot for adding them.

1 Like

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

2 Likes

This script is amazing, thank you!

3 Likes