Lingua::Han2PinYin - convert Chinese character(Mandarin) to its pinyin.
use Lingua::Han2PinYin; # if the format of your script is gb2312, default my $h2p = new Lingua::Han2PinYin(); print $h2p->han2pinyin("我"); # if the format of your script is utf-8 my $h2p = new Lingua::Han2PinYin(format => 'utf8'); print $h2p->han2pinyin("我");
There is a Chinese document @ http://www.1313s.com/f/Han2PinYin.html. It tells why and how I write this module.
if the character is polyphone(DuoYinZi), we can NOT point out the correct one.
if it's a common character, it returns its pinyin/spell.
if not, it returns 'XX';
Fayland, fayland@gmail.com
Copyright (c) 2005 Fayland All rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.