Request to include radical kanji in Found in Kanii list

I think your interpretation of what she said is reasonable, but unfortunately, it’s a bit of a misunderstanding.
I’m about to explain why it’s correct, but I’ll just mention that I’m not defending keeping it the way it is, since I also expressed my desire to have a way to view the components for radicals in a related topic.

To explain, let’s consider the data available via the API, which I’ll assume is virtually the same as what they’re using to link the items.
The data property of the subject contains a property called amalgamation_subject_ids, which is an array of ids for the subjects in which this subject is used[1].
For “kanji” and “vocabulary” types, they also have a property called component_subject_ids, which is an array of ids for the subjects which this subject is comprised of, however, that property is not included for radicals.
Therefore, the referential nature of radicals → kanji is unidirectional and does not go in reverse. That is to say, the data simply isn’t there for the reverse. That’s why a radical can list the kanji that it’s used in but it can’t (as it currently stands) link the radical(s)/kanji that formed it.


Though, if someone wanted to attempt to programmatically add that data, it might look something like this…

for (let i=0; i < subjects.length; i++) {
    const item = subjects[i];
    if (item.object !== 'radical') continue;
    const sharedKanji = subjects.find(d => d.object === 'kanji' && d.data.characters === item.data.characters);
    if (!sharedKanji) continue;
    item.shared_kanji = sharedKanji.id;
    // avoid a circular reference when the radical is the component for the kanji
    if (sharedKanji.data.component_subject_ids.includes(item.id)) continue;
    item.data.component_subject_ids = [...sharedKanji.data.amalgamation_subject_ids];
}

:person_shrugging:
Assuming that doesn’t create problems elsewhere, maybe I’ll suggest it as an addition to WKOF or something haha.
(That said, it’s more of a brute force approach and likely doesn’t take into account various factors, nor does it solve the situation for the rest of the radicals that aren’t directly formed from a single kanji)


  1. To be clear, for this example, you can replace the words “subject” with “radical” and replace “subjects” for “kanji”, but note that it works the same for kanji to vocab, for example. ↩︎

2 Likes