NAME

Lingua::JA::Romanize::Kana - Romanization of Japanese Hiragana/Katakana

SYNOPSIS

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;
    }
}

DESCRIPTION

Hiragana and Katakana are general terms for the syllabic Japanese scripts.

METHODS

$conv = Lingua::JA::Romanize::Kana->new();

This constructer methods returns a new object with its dictionary cached.

$roman = $conv->char( $Kana );

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.

$roman = $conv->chars( $string );

This method returns romanized letters from multiple Kana characters.

@array = $conv->string( $string );

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

UTF-8 FLAG

This treats utf8 flag transparently.

SEE ALSO

Lingua::JA::Romanize::Japanese

COPYRIGHT AND LICENSE

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.