Lingua::JA::Romanize::Kana - Romanization of Japanese Hiragana/Katakana
use Lingua::JA::Romanize::Kana; my $conv = Lingua::JA::Romanize::Kana->new(); my $roman = $conv->char( $kana ); printf( "<ruby><rb>%s</rb><rt>%s</rt></ruby>", $kana, $roman ); my @array = $conv->string( $string ); foreach my $pair ( @array ) { my( $raw, $ruby ) = @$pair; if ( defined $ruby ) { printf( "<ruby><rb>%s</rb><rt>%s</rt></ruby>", $raw, $ruby ); } else { print $raw; } }
Hiragana and Katakana are general terms for the syllabic Japanese scripts.
This constructer methods returns a new object with its dictionary cached.
This method returns romanized letters from a Kana character. It returns undef when $Kana is not a valid Kana character. The argument's encoding must be UTF-8. Both of Hiragana or Katakana characters are allowed. But Kanji character is not supported by this module. See Lingua::JA::Romanize::Japanese.
This method returns romanized letters from multiple Kana characters.
This method returns a array of referenced arrays which are pairs of a Kana chacater and its romanized letters.
$array[0] # first Kana character's pair (array) $array[1][0] # secound Kana character itself $array[1][1] # its romanized letters
This treats utf8 flag transparently.
Lingua::JA::Romanize::Japanese
Copyright (c) 2006-2008 Yusuke Kawasaki. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Lingua::JA::Romanize::Japanese, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Lingua::JA::Romanize::Japanese
CPAN shell
perl -MCPAN -e shell install Lingua::JA::Romanize::Japanese
For more information on module installation, please visit the detailed CPAN module installation guide.