[Userscript] ConfusionGuesser

ConfusionGuesser

General script installation instructions
Open Framework installation
ConfusionGuesser
Recommended: activate “Use IDS” in the settings menu (see screenshots below)

What does it do?

If you give a wrong answer during a review, this script guesses which other WK items you confused the question with and displays them in a list, so that you can review the differences immediately.

More precisely, if you answered with a wrong meaning, it displays items with your entered meaning, and if you answered with a wrong reading, it displays items with your entered reading. The displayed items are (supposed to be) sorted by visual similarity.

Screenshots

I recommend activating “Use IDS”. This downloads and locally stores a 2 MB textfile containing ideographic description sequences for kanji. My script uses them to improve the kanji similarity rating. This ids.txt file will be downloaded from https://github.com/cjkvi/cjkvi-ids, which derived it from http://www.chise.org. I’m associated with neither of these projects, so I don’t know if it will stay available/compatible.

Here’s what happens if you panic and completely butcher a reading (the correct reading would have been きょうこう):

And here the mistake is only at the first kanji (the correct reading would have been へいじょう):

Additional remarks

The overlay containing the list of guesses might cover the review question if your screen or your browser window is not wide enough. I could not think of a good solution to this, but you can disable “Show as overlay” in the settings menu and the guess list will instead be appended at the bottom of the page (below a certain window width this will happen automatically).

Version history

v 1.11 (Bugfix for spoiler check on items not yet learned)

To the post with details about this patch

v 1.10 (Switched to spaced_repetition_systems API endpoint)

To the post with details about this patch

v 1.9 (Added hover tip to guesses)

To the post with details about this patch

v 1.8 (Added option to hide guess type)

To the post with details about this patch

v 1.7 (image radical support)

image radical support, joke meaning filter, text color setting, “From button color” option
To the post with details about this patch

v 1.6 (The script now also runs on the WK preview server)

To the post with details about this patch

v 1.5 (Added spoiler warning feature)

To the post with details about this patch

v 1.4 (Bugfix for duplicate removal)

To the post with details about this patch

v 1.3 (Changed duplicate removal)

To the post with details about this patch

v 1.2 (Whitelist and user synonyms)

Meaning guesses can now consider the hidden WK whitelist and user synonyms (disabled by default)
To the post with details about this patch

v 1.1 (font size setting)

Added a dropdown setting for the font size of guesses
To the post with details about this patch

59 Likes

For the second one, another correct reading is ぴょんやん (as far as I know, it’s the preferred reading too)

What happens if you input, say ひょうやん?
Or when you make mistakes on ateji in general? Like typing したて for 下手? Do you have a specific case for special readings?

My script only uses the on’yomi/kun’yomi/nanori information from WaniKani, so it cannot know how to split up the reading ぴょんやん to the two kanji - therefore there are no guesses and the overlay is not displayed. The same applies to 下手.

If only one of the kanji has an unexpected reading, like in 河童かっぱ, and you answer with かどう, the guesses are:

Kappa

(In fact, it splits the reading into かっ and , therefore 河 is also listed as on<=>on mistake, because the gemination was not applied)

2 Likes

I’m definitely going to try this out! The best way to squash leeches is seeing the difference between the items your confusing.

Maybe a little feature suggestion: showing the transitive and intransitive form if the error occurs there? Might be a bit too hard though. Although I guess the yellow bar might actually already show it.

2 Likes

Great job mate.
I wish I had this when I was going through wanikani :<

5 Likes

Thanks for this!!! I LOVE THIS SCRIPT!!!

Just tested it on my 2nd account because my main account has 0 review. I use Firefox on Mac.

3 Likes

Oh man, oh man, oh man…

I love it!

1 Like

I wish it could be available on the iPhone because I do most of my reviews there

Waow such good much powerful. Guddo shigoto my tomodachi :heart_eyes:

5 Likes

I’ve been asking for a script like this for years. I can even click on the side pop up to open a new tab automatically. Words can’t express how great this script is.

5 Likes

Omg this will make so many leeches to go away. Thank you so much :OO :yellow_heart:

4 Likes

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 (https://www.wanikani.com/review/session)
  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