NAME

Lingua::JA::Romaji - Perl extension for romaji and kana conversion

SYNOPSIS

use Lingua::JA::Romaji ':romajitokana,:kanatoromagi';

&romajitokana(romaji, [hira|kata])
&kanatoromaji(EUC-encoded kana)

DESCRIPTION

Transliterates from roman characters to kana syllables, and back again.

Given an EUC-encoded string of kana $kana, $roma=&kanatoromaji($kana) will convert to Hepburn romaji. Hiragana is converted to lower case, ad katakana is converted to uppercase. Given a string of romaji, $kana=&romajitokana($roma,$kanatype) will convert to EUC-encoded kanji. If $kanatype matches the pattern /kata/i, it will be katakana, otherwise it will be hiragana.

To change the romafication style, you can modify the entries of %Lingua::JA::Romaji::allkana. Each key is a single kana, and each value is the corresponding romaji equivalent.

EXPORT

None by default.

&romajitokana, &kanatoromaji are available with EXPORT_OK, as are %hiragana and %katakana.

BUGS

When using &kanatoromaji($kana), $kana should contain only proper EUC-encoded kana of the form 0xA4 or 0xA5 followed by a single byte.

Care should be taken when modifying %Lingua::JA::Romaji::allkana to avoid the strings /ix/i or /ux/i as they will be removed in conversion.

Conversion is not necessarily reversible. This is because there can be many romaji representations of given kana.

Certain morae, namely /v[aeiou]/, can only be represented with katakana, and &romajitokana will produce katakana characters for these morae even in hiragana mode.

Kanji is not implemented at all. It is a non-trivial problem, and beyond the scope of this module.

Behavior on non-little endian machines for &kanatoromaji is not yet known.

LICENSE

This is a derived work of Jim Breen's XJDIC, and as such is licensed under the GNU General Public License, a copy of which was distributed with perl. #'

AUTHOR

Jacob C. Kesinger <kesinger@math.ttu.edu>

SEE ALSO

perl.