Golang library for convertiong hiragana to romaji, katakana to romaji, romaji to hiragana, and romaji to katakana.
Simply install with go get
:
go get github.com/gojp/kana
s := kana.KanaToRomaji("バナナ") // -> banana
s = kana.KanaToRomaji("かんじ") // -> kanji
s := kana.RomajiToHiragana("kanji") // -> かんじ
s = kana.RomajiToKatakana("banana") // -> バナナ
kana.IsLatin("banana") // -> true
kana.IsLatin("バナナ") // -> false
kana.IsKana("banana") // -> false
kana.IsKana("バナナ") // -> true
kana.IsKanji("banana") // -> false
kana.IsKanji("減少") // -> true
Normalize a romaji string to a standardized form (from the form given by Google Translate, for example):
kana.NormalizeRomaji("Myūjikku") // -> myu-jikku
kana.NormalizeRomaji("shitsuree") // -> shitsurei
Please feel free to use, contribute, and enjoy! You can also see this in action at nihongo.io.