-
-
23 Apr 2017 00:58:34 UTC
- Distribution: Lingua-Han-PinYin
- Module version: 0.23
- Source (raw)
- Browse (raw)
- Changes
- How to Contribute
- Repository
- Issues (1)
- Testers (727 / 0 / 0)
- Kwalitee
Bus factor: 1- 88.54% Coverage
- License: perl_5
- Activity
24 month- Tools
- Download (202.44KB)
- MetaCPAN Explorer
- Permissions
- Subscribe to distribution
- Permalinks
- This version
- Latest version
- Dependencies
- File::Spec
- Lingua::Han::Utils
- and possibly others
- Reverse dependencies
- CPAN Testers List
- Dependency graph
NAME
Lingua::Han::PinYin - Retrieve the Mandarin(PinYin) of Chinese character(HanZi).
SYNOPSIS
use Lingua::Han::PinYin; my $h2p = Lingua::Han::PinYin->new(); # han2pinyin my $pinyin = $h2p->han2pinyin("我爱你"); # woaini my @result = $h2p->han2pinyin("爱你"); # @result = ('ai', 'ni');
DESCRIPTION
Convert Mandarin to its spell
RETURN VALUE
Usually, it returns its pinyin/spell.
if not (I mean it's not a Chinese character), returns the original word.
OPTION
- tone => 1|0
-
default is 0. if 1, return kua4 instead of kua
my $h2p = Lingua::Han::PinYin->new(tone => 1); print $h2p->han2pinyin("我"); #wo3 my @result = $h2p->han2pinyin("爱你"); # @result = ('ai4', 'ni3');
- unicode => 1|0
-
default is 0, if 1, return kuà instead of kua4 OR kua
my $h2p = Lingua::Han::PinYin->new(unicode => 1); print $h2p->han2pinyin("叶问"); # yèwèn
- capitalize => 1|0
-
default is 0, if 1, will capitalize each pinyin word
my $h2p = Lingua::Han::PinYin->new(capitalize => 1); print $h2p->han2pinyin("汉语拼音"); # HanYuPinYin
METHODS
- han2pinyin
-
print $h2p->han2pinyin("林道"); #lin2dao4 print $h2p->han2pinyin("I love 余瑞华 a"); #i love yuruihua a
- han2pinyin1
-
for 1 chinese letter at a time, han2pinyin1 is faster
# if you are sure to pass 1 Chinese letter at a time, han2pinyin1 is faster print $h2p->han2pinyin1("我"); # wo
- gb2pinyin
-
if you are sure your encoding is GB2312, gb2pinyin is faster
print $h2p->gb2pinyin("I love (汉语)拼―音 Ah"); # I love (hanyu)pin―yin Ah
SEE ALSO
AUTHORS
Fayland Lam,
<fayland at gmail.com>
Tong Sun,
<suntong at cpan.org>
COPYRIGHT
Copyright (c) 2005-2012 *AUTHORS* All rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Module Install Instructions
To install Lingua::Han::PinYin, copy and paste the appropriate command in to your terminal.
cpanm Lingua::Han::PinYin
perl -MCPAN -e shell install Lingua::Han::PinYin
For more information on module installation, please visit the detailed CPAN module installation guide.