During the Nanban Trade Period (Nanban Boeki Jidai), western vocabulary was first introduced in the Japanese language as a result of the interaction between Europeans and the Japanese people.
"They eat with their fingers instead of with chopsticks such as we use. They show their feelings without any self-control. They cannot understand the meaning of written characters." (from Boxer, Christian Century).
“They never touch food with their fingers, but instead use two small sticks that they hold with three fingers.” “They blow their noses in soft silky papers the size of a hand, which they never use twice, so that they throw them on the ground after usage, and they were delighted to see our people around them precipitate themselves to pick them up.” “Their swords cut so well that they can cut a soft paper just by putting it on the edge and by blowing on it.” (Marcouin, Francis and Keiko Omoto. Quand le Japon s’ouvrit au monde.)
namban is a Clojure(Script) Japanese library for trading between Hiragana, Katakana, Romaji, for identifying script types and more.
API is available both in Romaji and Kana.
user=> (use 'namban.boeki)
nil
user=> (hiragana? "ねこがかわいいでしょう")
true
user=> (->hebon "このパンがおいしい") ; use tools like kuromojure or clj-mecab to segment the text
"konopan'gaoishii"
user=> (katakana->romaji "このパンがおいしい")
"このpan'がおいしい"
user=> (ローマじ->ひらがな "wareware wa uchūjin desu")
"われわれ わ うちゅうじん です" ; no way to know wa is a particle
user=> (scripts "こいつぁなあ、南蛮渡来の品もんだぜぇ!")
#{:kanji :yakumono :hiragana}
user=> (henkan "nihon e shuupatsu" :wapuro :kunrei)
"nihon e syûpatu"When the target conversion script is :hebon, and は, へ, を are used as
particles, they will be converted to ha, he, wo, instead of the expected wa e o, respectively.
Romaji long vowels ō, ô conversions to おお, oo, respectively, when applicable is not supported. Defaults are おう, ou - as this is the most common case.
All occurrences of ん, ン will be converted to romaji n' regardless of their position in words, although this behaviour will be improved in future releases.
Tools like kuromojure or clj-mecab segment text which can improve namban's accuracy.
- kana->X conversions
- katakana/romaji-upper-case and hiragana/romaji-lower-case formats
- support hankaku-katanana script
- support hyōjun-shiki script
- consonant expansion
Feature requests are welcome!
Megumi Imai
Copyright (C) 2015 Carlos C. Fontes.
Double licensed under the Eclipse Public License (the same as Clojure) or the Apache Public License 2.0.

