The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Lingua::JA::Hepburn::Passport - Hepburn Romanization using Japanese passport rules

SYNOPSIS

  use utf8;
  use Lingua::JA::Hepburn::Passport;

  my $hepburn = Lingua::JA::Hepburne::Passport->new;
  $hepburn->romanize("みやがわ");     # MIYAGAWA
  $hepburn->romanize("おおの");       # ONO
  $hepburn->romanize("かとう");       # KATO
  $hepburn->romanize("ゆうこ");       # YUKO
  $hepburn->romanize("なんば");       # NAMBA
  $hepburn->romanize("はっちょう");   # HATCHO

  # Indicate long vowels by "h"
  my $hepburn = Lingua::JA::Hepburne::Passport->new( long_vowels_h => 1 );
  $hepburn->romanize("おおの");       # OHNO
  $hepburn->romanize("かとう");       # KATOH

DESCRIPTION

Lingua::JA::Hepburn::Passport is a Hiragana/Katakana to Romanization engine using Japanese passport rules. There're already some Hepburn romanization modules on CPAN but none of them conform to the one used in Japanese passport, hence I made another one.

METHODS

new
  $hepburn = Lingua::JA::Hepburn::Passport->new;
  $hepburn = Lingua::JA::Hepburn::Passport->new( long_vowels_h => 1 );

Creates new object. Optionally you can pass long_vowels_h parameter to 1, with which this module tries to add H to the long vowels OO and OU, as allowed in Japanese passport rules.

romanize
  $roman = $hepburn->romanize( $kana );

Romanizes the string $kana using Hepburn romanization. $kana should be either Hiragana or Katakana, as an Unicode string in Perl (a.k.a UTF-8 flagged), otherwise it throws an error. Returned $roman would be all upper case roman letters.

This module doesn't come with deromanize method (yet), which would do the Roman to Katakana/Hiragana translation, since I don't think we need it. Other modules on CPAN alaredy do the job quite nicely.

AUTHOR

Tatsuhiko Miyagawa <miyagawa@bulknews.net>

LICENSE

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

Some of the code algorithm are ripped off from http://www.d-project.com/hebonconv/

SEE ALSO

http://www.seikatubunka.metro.tokyo.jp/hebon/, http://en.wikipedia.org/wiki/Hepburn_romanization, Lingua::JA::Romanize::Kana