NAME
Lingua::Han::PinYin - Retrieve the Mandarin(PinYin) of Chinese character(HanZi).
SYNOPSIS
use Lingua::Han::PinYin;
# if the format of your script is gb2312, default
my $h2p = new Lingua::Han::PinYin();
print $h2p->han2pinyin("我"); # wo
# if the format of your script is utf-8
my $h2p = new Lingua::Han::PinYin(format => 'utf8');
print $h2p->han2pinyin("我"); # wo
my @result = $h2p->han2pinyin("çˆ±ä½ "); # @result = ('ai', 'ni');
# we can set the tone up
my $h2p = new Lingua::Han::PinYin(format => 'utf8', tone => 1);
print $h2p->han2pinyin("我"); #wo3
my @result = $h2p->han2pinyin("çˆ±ä½ "); # @result = ('ai4', 'ni3');
print $h2p->han2pinyin("林�"); #lin2dao4
print $h2p->han2pinyin("I love 余瑞� a"); #i love yuruihua a
DESCRIPTION
There is a Chinese document @ http://www.fayland.org/project/Han-PinYin/. It tells why and how I write this module.
RESTRICTIONS
if the character is polyphone(DuoYinZi), we can NOT point out the correct one.
RETURN VALUE
Usually, it returns its pinyin/spell. It includes more than 20,000 words (from Unicode.org Unihan.txt, version 4.1.0).
if not(I mean it's not a Chinese character), returns the original word;
OPTION
- format => 'utf8|gb2312'
-
If you are in 'Unicode Editing' mode, plz set this to utf8, otherwise('ASCII Editing') use the default.
- tone => 1|0
-
default is 0. if tone is needed, plz set this to 1.
SEE ALSO
AUTHOR
Fayland, fayland@gmail.com
feel free to contact me.
COPYRIGHT
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.
See http://www.perl.com/perl/misc/Artistic.html
1 POD Error
The following errors were encountered while parsing the POD:
- Around line 63:
Non-ASCII character seen before =encoding in '$h2p->han2pinyin("我");'. Assuming CP1252