Tatsuhiko Miyagawa > Lingua-JA-Hepburn-Passport > Lingua::JA::Hepburn::Passport

Download:
Lingua-JA-Hepburn-Passport-0.02.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.02   Source  

NAME ^

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

SYNOPSIS ^

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

  my $hepburn = Lingua::JA::Hepburn::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::Hepburn::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.

WHY ^

There is already a couple of Hepburn romanization modules on CPAN (See "SEE ALSO"), but none of them conform to the conversion rule defined in Japanese passport regulation. This one does.

METHODS ^

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

Creates a 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 already 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.

Code algorithm is based on 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, Lingua::JA::Kana

syntax highlighting: