Elixir port of willnet/gimei
# mix.exs
defp deps do
[
{:gimei_ex, "~> 1.0.0"},
{:yamerl, github: "yakaz/yamerl", tag: "v0.3.2-1"}
]
end
and fetch
$ mix deps.get
iex> gimei = GimeiEx.name
%GimeiEx.Name{first: %GimeiEx.Name.First{hiragana: "さちこ",
kanji: "佐知子", katakana: "サチコ"},
last: %GimeiEx.Name.Last{hiragana: "おかざき", kanji: "岡崎",
katakana: "オカザキ"}}
iex> alias GimeiEx.Name
iex> Name.kanji(gimei) #=> "岡崎 佐知子"
iex> Name.hiragana(gimei) #=> "おかざき さちこ"
iex> Name.katakana(gimei) #=> "オカザキ サチコ"
iex> gimei.last.kanji #=> "岡崎"
iex> gimei.last.hiragana #=> "おかざき"
iex> gimei.last.katakana #=> "オカザキ"
iex> gimei.first.kanji #=> "佐知子"
iex> gimei.first.hiragana #=> "さちこ"
iex> gimei.first.katakana #=> "サチコ"
iex> address = GimeiEx.address
%GimeiEx.Address{city: %GimeiEx.Address.City{hiragana: "くろべし",
kanji: "黒部市", katakana: "クロベシ"},
prefecture: %GimeiEx.Address.Prefecture{hiragana: "みえけん",
kanji: "三重県", katakana: "ミエケン"},
town: %GimeiEx.Address.Town{hiragana: "かみつしままちごねお",
kanji: "上対馬町五根緒", katakana: "カミツシママチゴネオ"}}
iex> alias GimeiEx.Address
iex> Address.kanji(address) #=> "三重県黒部市上対馬町五根緒"
iex> Address.hiragana(address) #=> "みえけんくろべしかみつしままちごねお"
iex> Address.katakana(address) #=> "ミエケンクロベシカミツシママチゴネオ"
iex> address.prefecture.kanji #=> "三重県"
iex> address.prefecture.hiragana #=> "みえけん"
iex> address.prefecture.katakana #=> "ミエケン"
iex> address.city.kanji #=> "黒部市"
iex> address.city.hiragana #=> "くろべし"
iex> address.city.katakana #=> "クロベシ"
iex> address.town.kanji #=> "上対馬町五根緒"
iex> address.town.hiragana #=> "かみつしままちごねお"
iex> address.town.katakana #=> "カミツシママチゴネオ"
# 省略形
iex> prefecture = GimeiEx.prefecture
%GimeiEx.Address.Prefecture{hiragana: "おおいたけん", kanji: "大分県",
katakana: "オオイタケン"}
iex> prefecture.kanji #=> "大分県"
iex> city = GimeiEx.city
%GimeiEx.Address.City{hiragana: "みずなみし", kanji: "瑞浪市",
katakana: "ミズナミシ"}
iex> city.hiragana #=> "みずなみし"
iex> town = GimeiEx.town
%GimeiEx.Address.Town{hiragana: "たらわらまち", kanji: "俵原町",
katakana: "タラワラマチ"}
iex> town.katakana #=> "タラワラマチ"
MIT