Dev Log (Kanji Aid #1)
It’s super hard to write a blog while putting 100% of your all into learning something else.
But blog we must. And blog we shall.
June 2nd, 2022: Kanji Radicals
Today was Day 2 working on the kanji radical system. It is frustrating to develop this because Japanese, like all languages, isn’t consistent at all. The irregularities and exceptions are endless. Here is a my attempt at it.
Every kanji is made up of several radicals.
Radicals can be another kanji: 木 (tree) in 朴 (crude).
Or they can be pure radicals: ⼚ (cliff) in 坂 (slope). In this case ⼚ isn’t a kanji. It’s just a piece used in many kanji.
So I needed to develop a system that:
- Takes a kanji and finds what radicals it has (from a json).
- Ignore that radical is it has the same keyword as the kanji it belongs to. (Tree is a radical and a kanji, don’t want to show it to the user)
- Find radicals in the kanji json by keyword.
- But some radicals have multiple keywords, so we need to create a special list every time we look for radicals to make sure no duplicate kanji/radicals appear and which also gives us access to those keywords so the users can use them to make mnemonics later.
- Some radicals are “pure” and aren’t in the json at all. These we have to get another way.
- But those “pure” radicals share keywords with kanji that are in the json. So searching for stuff by keyword returns false positives.
7. Just give up and live in a cave. Send my family mushrooms.
So I gotta make an algorithm that does all that and I’m still learning Swift and Swift UI and hoo boy, what a day. Can’t wait for those bugs to start popping up.
Thanks for reading. Any advice or wanna chat? Please reach out.