Skip to content

namban is a Clojure(Script) library for conversion between Hiragana, Katakana, Romaji and more.

Notifications You must be signed in to change notification settings

kanasubs/namban

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

namban Build Status

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.

Namban Carrack

"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).

Hasekura in Rome

“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.

Install

clojars version

Tatoeba

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"

Tests and full API

Shortcomings

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.

Improving conversions

Tools like kuromojure or clj-mecab segment text which can improve namban's accuracy.

Wishlist

  • kana->X conversions
  • katakana/romaji-upper-case and hiragana/romaji-lower-case formats
  • support hankaku-katanana script
  • support hyōjun-shiki script
  • consonant expansion

Something is missing?

Feature requests are welcome!

Japanese language Q&A by

Megumi Imai

License

Copyright (C) 2015 Carlos C. Fontes.

Double licensed under the Eclipse Public License (the same as Clojure) or the Apache Public License 2.0.

About

namban is a Clojure(Script) library for conversion between Hiragana, Katakana, Romaji and more.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •