NAME
Lingua::Han2PinYin - convert Chinese character to its pinyin.
SYNOPSIS
use Lingua::Han2PinYin;
my $hanzi = "ÎÒ"; # the Chinese character
my $pinyin = han2pinyin($hanzi); # the corresponding spell
#now $pinyin is 'wo';
my $juzi = "ÎÒÊÇÖйúÈË";
my $juzi_pinyin = han2pinyin($juzi);
#now $juzi_pinyin is 'wo shi zhong guo ren');
my @juzi = qq/ÎÒ ÊÇ ÖÐ ¹ú ÈË/;
my @pinyin = han2pinyin(@juzi);
#now @pinyin is ('wo', 'shi', 'zhong', 'guo', 'ren')
DESCRIPTION
There is a Chinese document @ http://www.1313s.com/f/Han2PinYin.html. It tells why and how I write this module.
This heavy version can deal with 27805 characters and 475 pinyin.
Feel free to add new characters and send me messages.
RESTRICTIONS
if the character is polyphone(DuoYinZi), we can NOT point out the correct one.
OPTION
Parameter can be scalar(one word or more) and array.
RETURN VALUE
if it's a common character, it returns its pinyin/spell.
if not, it returns 'XX';
if you wantarray, it returns array else return scalar.
BUGS
I'm not sure it works at all OS or different versions of perl.
Follows are tested, and feel free to report any bugs or corrections:
Win2000(SP4) + ActivePerl 5.8.5
SEE ALSO
Lingua::Han2PinYin::Light
AUTHOR
Fayland, fayland@gmail.com
1 POD Error
The following errors were encountered while parsing the POD:
- Around line 523:
Non-ASCII character seen before =encoding in '"ÎÒ";'. Assuming CP1252