-
-
09 Dec 2007 12:00:57 UTC
- Distribution: Lingua-JA-Hepburn-Passport
- Module version: 0.02
- Source (raw)
- Browse (raw)
- Changes
- How to Contribute
- Issues
- Testers (599 / 18 / 3)
- Kwalitee
Bus factor: 1- 43.40% Coverage
- License: perl_5
- Activity
24 month- Tools
- Download (34.65KB)
- MetaCPAN Explorer
- Permissions
- Subscribe to distribution
- Permalinks
- This version
- Latest version
- Dependencies
- unknown
- Reverse dependencies
- CPAN Testers List
- Dependency graph
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
Module Install Instructions
To install Lingua::JA::Hepburn::Passport, copy and paste the appropriate command in to your terminal.
cpanm Lingua::JA::Hepburn::Passport
perl -MCPAN -e shell install Lingua::JA::Hepburn::Passport
For more information on module installation, please visit the detailed CPAN module installation guide.