Home / JavaScript / Japanese On Github

Learn Japanese: Write-up

Writeups are written in the past tense even while the project is being worked on, so that they read like a retrospective....

This was a very fun project to work on. It is based on an older and much simpler project of mine which had no settings, within which I would make changes to the source code in order to adjust the test. Each question group corresponds to a dictionary in the source code with the kana/kanji as keys and the expected answers as values. QuestionGroup objects are constructed and arranged into a tree hierarchy, which the source code uses to generate the cascading list at the top of the page.

Originally, I had the idea of having each node in this tree calculate sums of weights from their children for the purposes of choosing questions. That way, I would be able to uniformly choose a question by descending the tree only once, which would be very performant. However, the "Question Window", which reduces the set of available questions and increases it over time, become a necessary feature, and couldn't be properly used with the tree. So instead, an array of active questions is maintained and updated each time a question is generated. The array includes all selected questions, and only the first few can actually be chosen as per the window size.

The user is being graded, although an attempt is made to keep the page from feeling like an oppressive test and more like flash cards. The grades are used to increase the chance of problematic questions being picked (in adaptive mode) and to determine whether the question window size can be increased (if Use Window is checked).

I have wondered whether working on the project has done more for my knowledge of kana than using it has. For sure, it requires some testing by other people.