[Userscript] Niai 似合い Visually Similar Kanji

Looks like there were now major problems, marked as stable now.

Fixes:
Changed sorting in grid. Kanji in the grid are sorted by a score, previously the order was not unique when the score was equal, so the kanji would shift around in the grid after deletion (annoying when you wanted to delete two kanji in a row quickly)

1 Like

https://www.wanikani.com/kanji/%E5%88%83

匁 has “undefined” under reading. I am aware it has no 音読み listed on Jisho, just thought I’d mention it.

1 Like

@gzovak, Thanks, I also found it, it’s fixed now. It was the only one in the database.

I was pleasantly surprised to see this pop up during lessons (I missed reading this was a thing).
However I wasn’t happy with it’s position within the examples tab so I went to edit it in Tampermonkey to change it to how I would like but the way you have things set up doesn’t allow me to easily change it. I would have liked to put it underneath the Vocabulary Examples section i.e. after the div#supplement-kan-related-vocabulary instead of before it. Maybe have it as a variable in the script so one can change the location of the Visually Similar Kanji section to their liking?

Would you be able to do something like this?

Or maybe I completely missed something, in which case could you point me in the right direction?

I was thinking about some way to move it (like drag and drop or up/down buttons) and then remember the change. I will move the vocab examples up by default for now, it has a fixed height so it’s better on top.

Edit: you can get the new version now :wink:

1 Like

@jprspereira

Your questions is related to Niai :wink:

Actually I am not really checking which items you have unlocked, I just show everything on your current level or higher as locked. It looked like you need to download a lot of stuff each time to make the check. However I’m considering to use new API v2 to fetch this from WK. The readings and meanings I use are also detached from WK, this will be better then as well.

1 Like

I see, thank you for the clarification :slight_smile:

1 Like

This is an amazing plugin, very helpful, thank you!

Suggestion (or maybe I’m stupid and haven’t found it): please make reordering of the similar kanji possible. Now I have to delete the non-similar kanji in front (how does the plugin determine them anyway?) which presumably makes them disappear forever?

1 Like

My pleasure :wink:

There is a “reset button” to make everything factory state again for a single kanji, it basically deletes the current kanji from the override DB (see below).

The userscript uses several data sources that give “points” to kanji, which determines the order.

Items 2. and 3. come from a doctoral thesis of someone (http://lars.yencken.org/datasets/phd/). They are machine-generated as far as I understand. Mostly very good, but sometimes there is a 一 or 二 or something with an insanely high score hidden in-between. Main reason why there is an editing feature :wink: These two databases already contains a score from 0–1, so I just use that. (They only have 1945 kanji, however, so a few hundred kanji in WK are not covered.)

If a kanji appears in several places the “higher number” database in this list is used.

  1. The database from the obsolete similar kanji script, everything gets score 0.4
  2. A “Yeh and Li” dataset, somehow based on radicals
  3. “Stroke distance”, I think it tries to figure out how much must change to get from one kanji to the other
  4. Keisei DB (from my other plugin), here the radicals change but the tone mark stays the same (score 0.5)
  5. Manual DB (I’m adding a few kanji that were missed but I feel they should show up (score 0.8)
  6. Override DB: this is what you are editing, deleting gives score -1.0, adding score 1.0

So in principle it is possible to shift kanji around by pushing more differentiated scores than -1 or 1 to the override DB, but I haven’t figured out a way make it user-friendly :slight_smile: Drag’n’drop is possible, but probably not so simple to implement. You could add a kanji that is already in the list to give it a 1 score to move it to the front a bit, but at the moment there are no more user ordering options.

Thanks for your thorough explanation! Yeah, drag 'n drop would make this plugin perfect :slight_smile: Here’s to hoping :smiley:

1 Like

Adding kanji is a very slow process I found out, what would be super-slick is a “community edition” where sorting and additions are synced to others and you can move them around or delete them again (and get a score from that). But it seems there are not that many people who use this script, and a few weeks full-time would need some funding :slight_smile:

New version 1.1.0!

New features:

  • The order should now really be according to their score
  • New main database, based on the differences in pixels when rendered with the Noto font (currently testing other fonts). The more pixels in common, the higher the score, pixels that are not shared reduce the score, as well as differences in the “grayness” of the kanji.
  • Common kanji are capped at 19 items, deleting one will shift in everything with a score of 0.3 or higher.
1 Like

Would it be difficult to add the option to ‘clear all similar kanji’ for a given kanji? I’m getting a ton of kanji that I don’t think look similar at all, and of course when I delete them more just come in to fill the space. It would be nice to be able to clear them all at once then just add the ones I’m getting confused.

Also - you’re saying customizations get stored locally. How are you implementing that, the browser cache? I clear mine from time to time, so is there a way to export/import the database?

1 Like

Another option would be to make an adjustable threshold number. At the moment all available similar kanji are displayed, even if they have low scores (they will stop coming after 0–20 more kanji though :smile:). This will greatly reduce the number of similar kanji. I will have a look.

(Generally I find it easier to delete similar kanji than searching and adding them because it is really time consuming.)


Your personal database is stored inside Tampermonkey with GM_setValue. It survives clearing the browser cache, and I didn’t see any problem yet with Tampermonkey updates.

You can store it by going to the Tampermonkey Dashboard, click on the userscript name, and then copy/paste everything from the tab “Storage”. It contains the settings and the override_db with your modifications. You can also paste+save to restore an old version.

2 Likes

Version 1.1.2!

I added a “minimal score” option to remove the too many kanji problem! The score is a value from 0–1, higher values mean that the similar kanji must resemble the original one more closely. You should also check if you want the “Original Sources” option, the kanji there may not always fit, but sometimes there are some gems in there.

2 Likes

Thank you! Very helpful :+1:

exactly what I wanted!! thank you!

1 Like

I haven’t used this script yet, but I just wanted to come here to complain about these two kanji.

挙 拳

That’s just way to similar…

If you can see then together your problem is already decreased :slight_smile:

挙 is actually a victim of Japanese scripts reforms, the old one was more distinguishable (擧). But what can you expect from reforms that made two kanji exactly the same?

I’m using the semantic script of yours. May I ask what’s the difference to this one? Should I use this and remove the current script?