I want to categorize Japanese words base on there first character. For example:
Group 1
All Japanese word that starts from
ãa ãi ãu ãe ão
ãka ãki ãku ãke ãko
Group 2
All Japanese word that starts from
ãsa ãshi ãsu ãse ãso
ãta ã¡chi ã¤tsu ã¦te ã¨to
What makes it difficult is some characters in Japanese are written to different type such as Hiragana, Katakana and Kanji which words are written differently but same in meaning.
It might be possible if I could only convert hiragana, katakana or kanji to romaji.
Can someone help me, Is it possible in PHP? or is their a plugin in WordPress that can do this?
Here’s a hiragana javascript version. You could port it over by using PHP’s
preg_replace
You could also make a katakana version this way.
However, Kanji would be a lot more complicated.
This Gist I put together is a Javascript solution (rather than PHP), it only works for Hiragana and Katakana to Romaji, and it doesn’t handle all edge-cases, but you might still find it useful as a starting point: https://gist.github.com/Venryx/ecbea1a0c7a8a6cb21d80886488045f1