[Userscript] WaniKani Context


It’s a userscript that adds context sentences to your vocabulary reviews!
Also, first (real) post from a long time lurker. Yay!


Here (auto update should work now).
And if you want to know how it works, here’s the gist.


There have been numerous posts on how to install usercript clients at this point, so I’ll assume you can figure that out :slight_smile:


I found myself never paying much attention to the context sentences that WaniKani supplies. By showing them with the vocab, the experience of studying becomes much closer to how one would encounter the words in real life.


If you have any suggestions, let loose! I recon this is the first javascript I’ve ever shown to anyone else.
If you find any problems, let me know and I’ll do my darnedest to fix them.
Thanks @obskyr for explaining jStorage!



  • Initial release.


  • Started replacing vocab with regex split term.


  • Fixed sentence randomization bug.
  • Fixed regex search bug (by removing regex haha).
  • Context sentences for verbs are now ommited (until a conjugation solution is figured out).


  • Removed superfluous logs.
  • Enhanced appearance of example sentences.
  • Added vocab highlighting.


  • Removed script from lessons screen.
  • Force old styling when a context sentence can’t be loaded.


  • Added experimental verb conjugation.
  • Smoothed sentence loading glitches.


  • Fixed script compatibility issue by less destructively setting values in html.
  • Fixed issue where vocab with ‘〜’ not being parsed correctly.
  • Removed ‘experimental conjugation’ flag.


  • Fixed issue where context div wasn’t being hidden during kanji and radical reviews.


  • Fixed styles for users not running the Jitai script (whoops, lol)
  • Fixed code not running due to race condition if vocab appeared right as reviews start.
  • Gracefully failing when running into a conjugated adjective.


  • Changed script to run at document end. (Fixed odd behavior in Firefox)

nice one, thanks

Thanks! I’ve tested it on Chrome on Mac and it went great. I like it when I’m forced to look at the context sentences whether I can read it or not. I’ve added your script to The New And Improved List of API and Third Party Apps under Reviews.

Feedback: Can we have the vocabulary in question at the centre instead of at the right or at the left. So my eyes don’t have to search for the vocabulary first before I can answer the question/vocab review.

Also, I wonder if I can adjust the font size setting because I think they’re too big and eat up too many spaces on my screen.



I really like the idea, but I am worried that this would make reviews too easy. On the other hand, you would alway be seeing the word in context so maybe it’s fine? Anyone have any thoughts on this?

1 Like

Short version: Too easy/difficult is relative.

Longer version:
Too easy or too difficult depend on each preference. Just like banana jitai or any other not so familiar jitai font. Or just like using WK tooltip scripts. Or select the kanji/vocab then press something to summon yomichan power. Or ignore script. Or reorder script. It takes discipline not to abuse ourselves while WK-ing.

I personally think it’ll be too easy if I do my review on my second account which is lower than my main current WK level. For my main account, it’s still as hard as without context sentences. For example this one:

I think it’s good for training myself translating it to other languages (before pressing “f”). Here’s my try withouth pressing “f”: For the sake of increasing my spending time with my family on weekdays, I do all my homeworks at the weekend. Then I pressed “f” and hit “space” and reflected and learned something and sooner or later will learn something (related grammar I haven’t learned).

1 Like

@Oshin I can look into making the placement of the kanji and font size a bit more ergonomic. I was thinking it was feeling slightly off. My temporary solution was enabling scrolling, but that ain’t ideal. What do you reckon would feel better? Having the font size scaled down until everything fits on screen, or just chopping off what doesn’t fit?

@Kumirei I understand the sentiment. Though, at my current level, I haven’t found the context sentences have made anything easier. As I level up and my comprehension of the sentences go up, I think it would totally be possible to start memorizing the sentences. Buuuuuuuut I’m definitely not there yet :nerd_face:

Also, side note. I don’t think anyone’s noticed that I’ve been using the unconjugated form of the vocab word. I think I should also be replacing the vocab with the conjugated version… thoughts?

Having the font size scaled down until everything fits on screen. Chopping is no no. I’m happy with scrolling to the right so far. Wait. I like current font size for the vocab in question, I just want to make the other fonts smaller, not the vocab one. I hope the scaling down won’t affect all font size.

No, I noticed that but I was quiet. Suru ta. This is disturbing I think.

Yes, you should.

I’m curious, how do you deal with conjugations? I mean If the context sentence uses a past form, then how do your script find the vocabulary to make it bigger?
Edit: oh ok i just read the comments and see you didn’t :joy:

I’ve updated the script to use the regex split term instead of the raw vocab as the highlighted vocab!

Yeah, even this update won’t work perfectly (though it’s closer). Essentially if a particular conjugation is adding characters, the added characters won’t be highlighted… That is until I fix it. I should be able to update the regex with a list of known conjugation types, or something along those lines.


So, while I haven’t had time to work on an improved formatting or verb conjugation solution yet, I released a more stable v0.1.2. There was a bug where sentences weren’t being randomized due to another script I had installed. The wrong word was also getting selected in some sentences. This was due to the regex I was using that was supposed to detect variations of verb conjugation. I’ve disabled that (and consequently context sentences for verbs) until I can figure out a more reliable way to detect conjugated verbs.

I think that the best way for me to support context sentences with verbs is to have my script create the most common conjugations of the supplies vocab, and check the sentence for each conjugation in order of commonality.

Has anyone written a script that can conjugate vocab words yet?

1 Like

I forgot I installed this script and almost died when all those characters suddenly covered my screen…


I disabled this script until I see the write can make other than questioning vocabs much smaller.

I’m not a Javascript/Userscripts programmer, so my solution ideas could make this script worse or better :woman_shrugging: I wonder if it’s better to have a setting here to set fonts smaller. Fonts for the context sentence excluding the vocab in question.

Here, I’m showing you a long context sentence that made the vocab in question disappeared, or actually there, but, one, I had to search for it, two, I had to scroll in order to know what vocab in question was.

My ideas:
First idea. Something like hide/show by clicking the vocab in question. Why not just mouse hover? Because it was taken by jitai and show hints scripts.
Second idea. Something that make the context sentence moved to whatever direction, could be to the right if the vocab in question is at the left, could be to the left if the vocab in question is at the right, the point in this second idea is, to make the vocab in question right at the centre, so it’s easy to spot, without having to search for it first, then think about the answer, and type the answer.
Third idea. Cropping. This one was already mentioned by OP, not my idea. And I’d rather not have this, because the point of having this script enabled is to see the context sentence and force me as WK user to always read the context sentence.

If it’s programmatically difficult, I’m personally less annoyed by verb conjugation detection than having to search for the vocab in question. I can ignore that verb conjugation detection but I can’t ignore looking for the vocab in question first before thinking about the answer and then typing the answer.

That’s all my feedback today.

Hey all! Updated the script to v0.1.3. I’ve greatly improved the display of the context sentence/vocab. It may not be the ultimate solution, but it’s simple and sturdy. Essentially, I’m maintaining WKs flexible page style, and just scaling down the font size for context sentences. Then adding a backdrop and italicizing the vocab.

Let me know what y’all think.


Woah! Nice!

I like it being highlighted! And no more searching for the vocab in question! Thanks!

1 Like

Thank you so much for your script, I’ll definitely be using it.
I enjoy seeing the words in context, and having the possibility to read full sentences is great in my opinion.
With the latest update the review sentences are looking great,
but, I have noted a few issues :

In new Lessons the vocabulary is not centered anymore it is aligned to the left of the screen.

While reviewing, when no example sentence is loaded only the word to input,
it appears with a smaller font size than usual.
Unfortunately I didn’t take a screenshot of this, I’ll try to post one if I run into this issue again.

If you could fix those small bugs it would be great!
Keep up the good work!:+1:

1 Like

Fixed in 0.1.4! I’ve removed the script from the lessons screen alltogether, as I think it’s more important to focus on the actual vocab during lessons.

Fixed in 0.1.4 also! This was occuring when a scentence failed to load (which will happen for conjugated verbs). I fixed for now by reverting to the old style on failure, but I should have something figured out for verbs by the weekend or so.


Sweet! it looks nice now I think :slightly_smiling_face:

Hello all! Exciting news. I’ve gotten an experimental version of verb conjugation in and working in version 0.1.5!

The current approach is trying to find the dictionary form first, and if that fails, using a conjugation table to look for all the likely conjugations. At the moment everything seems stable enough to roll out to all of y’all, but there still may be bugs in the program.

When you see the ‘experimental conjugation’ tag appear at the bottom of the screen, double check the highlighted verb/conjugation to see if it’s correct. If it’s not, drop a post with the vocab/sentence pair so I can add it to my things to fix list.

1 Like

As a side note, having the verbs conjugated in context has been great practice for me so far! :nerd_face:

As a side side note, I figured out how to link the gist directly with a link that doesn’t change (i.e. auto update will actually work when it pings the download url). Please use the new link to install the script if you’ve installed already!

1 Like