[userscript] Transform on'yomi readings into katakana 2.1.4

Actually, I'm still around.
The reason I didn't update the script yet is that I need to level up in order to get new kanji lessons.

I think it's about time I get back on track with wanikani (you actually caught up to my level ^^).


It might take a few days but I will update the script. (502 reviews to go through)

For the "check the readings for mistakes" feature, I would need a list.
I could try to automatically check against a Japanese dictionary in the script I use to format the data but I can't promise anything^^

Oh, glad to see you’re still around and I hope you keep at it. :D That would be great if you could get it to check against a dictionary (maybe automatically from time to time). I wrote Koichi a couple of emails over the past months regarding wrong or interchanged readings and I bet other people did so as well. Sorry that I can’t provide you with a list, apart from 松 I don’t really remember what Kanji I mailed them about. Viet also told me it should be quite easy to create a new script using code from his Wanakana IME.
http://wanakana.com/

Thanks! :slight_smile:

Wow, love you. Thanks for taking the time to update it. :slight_smile:

Thanks, sorry it took so long ^^

It doesn't check readings against a dictionnary but I don't think it would be efficient to make the userscript check readings at runtime.

I am working on a python script to check Wanikani readings with the kanjidic project. I am not sure if I will be able to do it, but I will post with the results if I can find anything interesting.

Moreover, I think 松 may have been a result from an error in the previous version of my script. So I might be responsible for some (if not all) of the kunyomi readings wrongfully displayed in katakana. Sorry :( 

I didn't locate the error in my formating script (which downloads the data from the API and formats it for use in the userscript) but I rewrote it and I think it's fixed.

No, it’s not your fault at all, I had to write them an email about a few wrong readings and matsu was one of them. :slight_smile:

Your script is making the readings disappear in the item info during reviews. It works fine on item pages outside of reviews. Another user encountered the same problem.

ok, thanks for the bug report.
 I updated the script (version 2.0.2), does it fix the issue?

In case you haven’t noticed, Wanikani now has an official API to do romaji-hiragana-katakana conversions called Wanakana. It’s even loaded by default on review pages! Have you thought of using it? Might make your script easier to maintain :slight_smile:

Thanks for the script, maybe now I’ll finally remember Katakana properly!

ruipgpinheiro said... In case you haven't noticed, Wanikani now has an official API to do romaji-hiragana-katakana conversions called Wanakana. It's even loaded by default on review pages! Have you thought of using it? Might make your script easier to maintain :)

Thanks for the script, maybe now I'll finally remember Katakana properly!
Thanks for the tip !

However,  the hard part to maintain in my userscript is about finding readings in the different parts of Wanikani and figuring out if they are onyomi readings or not.

I already have my own implementation of hiragana to katakana conversion (a javascript object and a loop, basically ^^) so it's probably not worth the trouble to switch over to Wanakana now. ^^

thenn42 said...However,  the hard part to maintain in my userscript is about finding readings in the different parts of Wanikani and figuring out if they are onyomi readings or not.
Since you've already got it implemented, it might not help much, but during reviews, there's a very very easy way to do that as that information is included in the kanji metadata. Look at my Wanikani KunOn script for more details, but the basics are (repeat this everytime the Kanji changes):

var curItem =  $.jStorage.get("currentItem");

if(!("kan" in curItem)) //Not a kanji
   return;

if(curItem.emph == "onyomi")
   //Onyomi reading, do stuff
else
   //Kunyomi reading, do stuff
Maybe you already know this (I didn't look at your source) and if so nevermind.

I suppose I could do that. 
What I’ve been doing until now is (more or less)  :

if ($(#item-info-reading).children(“h2”).text() == “Important Readings (onyomi)”)
 //do something
I don’t really know how the client side reviews works but I assume I can’t convert the readings to katakana in Jstorage without messing with the client side reviews.
Therefore, my userscript is still dependent on the layout of the “item info” in order to convert the reading. Using Jstorage before that would add just another factor that could break my script in future updates and that’s always annoying ^^

However, looking at your code, I’m interested in using unsafeWindow (my script has been running in “sandbox mode”) to get better hooks during lessons/reviews.
I still have some reading to do about javascript though (it took me a few minutes to understand what you were doing with jQuery.jStorage.set ^^).

But lessons and reviews are easy, what’s really annoying are all those pages that don’t provide information on whether a reading is on or kun. So my userscript comes with a big json object (17KB) that tells me whether a kanji’s important reading is on or kun. (I don’t have to ask for the user’s API key that way.)




Thanks, I think this will become useful later on.

Thanks for helping me practice those darn katakanas

腹 is now fixed, with the correct on’yomi being フク. Thought I’d make you aware of it. :slight_smile:

floe said... 腹 is now fixed, with the correct on'yomi being フク. Thought I'd make you aware of it. :)
 Thanks! I updated my script :)

ワンダフル!とってもビエン!感謝してますわ!

Hey. Does it work during lesson sessions? Can someone please check? I am not sure if it does it at all because one other script might be interfering with it and I don’t have new lessons to test it on

Neither have I, but the code does have some lesson-page-specific code, so it should work unless it’s broken

As a sidenote: Since userscripts.org is down, use https://raw.githubusercontent.com/thenn42/Wanikani-On-yomi-in-katakana/master/OnyomiInKatakana.user… instead



babaleh said... Hey. Does it work during lesson sessions? Can someone please check? I am not sure if it does it at all because one other script might be interfering with it and I don't have new lessons to test it on
 Hey.
It should work during lesson sessions too.
I haven't leveled up in a long time so I'm not sure if everything is still working perfectly. If you come across a bug, tell me and I will do my best to fix it.


looki said... Neither have I, but the code does have some lesson-page-specific code, so it should work unless it's broken

As a sidenote: Since userscripts.org is down, use https://raw.githubusercontent.com/thenn42/Wanikani-On-yomi-in-katakana/master/OnyomiInKatakana.user.... instead



 I didn't know userscripts.org wasn't working anymore. I uploaded the script on Greasy fork:
https://greasyfork.org/scripts/747-wanikani-on-yomi-in-katakana

Also, the code on github wasn't up to date and was probably not working with lessons.

Thanks for the answers. It works during review. Will check if it works during lesson again when I have them. Yeah, I set it up to pull updates (and the initial code) from the github repo, so that shouldn’t be a problem.