GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Lingua::Han::PinYin(3) User Contributed Perl Documentation Lingua::Han::PinYin(3)

Lingua::Han::PinYin - Retrieve the Mandarin(PinYin) of Chinese character(HanZi).

  use Lingua::Han::PinYin;

  my $h2p = Lingua::Han::PinYin->new();

  # han2pinyin
  my $pinyin = $h2p->han2pinyin("我爱你"); # woaini
  my @result = $h2p->han2pinyin("爱你"); # @result = ('ai', 'ni');

Convert Mandarin to its spell

Usually, it returns its pinyin/spell.

if not (I mean it's not a Chinese character), returns the original word.

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
    

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
    

Unicode::Unihan

Fayland Lam, "<fayland at gmail.com>"

Tong Sun, "<suntong at cpan.org>"

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.

See <http://www.perl.com/perl/misc/Artistic.html>

2017-04-23 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.