1NAME 2 Lingua::ZH::Romanize::Pinyin - Romanization of Standard Chinese language 3 4SYNOPSIS 5 use Lingua::ZH::Romanize::Pinyin; 6 7 my $conv = Lingua::ZH::Romanize::Pinyin->new(); 8 my $roman = $conv->char( $hanji ); 9 printf( "<ruby><rb>%s</rb><rt>%s</rt></ruby>", $hanji, $roman ); 10 11 my @array = $conv->string( $string ); 12 foreach my $pair ( @array ) { 13 my( $raw, $ruby ) = @$pair; 14 if ( defined $ruby ) { 15 printf( "<ruby><rb>%s</rb><rt>%s</rt></ruby>", $raw, $ruby ); 16 } else { 17 print $raw; 18 } 19 } 20 21DESCRIPTION 22 Pinyin is a phonemic notation for Chinese characters. 23 24 $conv = Lingua::ZH::Romanize::Pinyin->new(); 25 This constructer methods returns a new object with its dictionary 26 cached. 27 28 $roman = $conv->char( $hanji ); 29 This method returns romanized letters of a Hanji character. It returns 30 undef when $hanji is not a valid Hanji character. The argument's 31 encoding must be UTF-8. Both of Simplified Chinese and Traditional 32 Chinese are allowed. 33 34 $roman = $conv->chars( $string ); 35 This method returns romanized letters of Hanji characters. 36 37 @array = $conv->string( $string ); 38 This method returns a array of referenced arrays which are pairs of a 39 Hanji chacater and its romanized letters. 40 41 $array[0] # first Chinese character's pair (array) 42 $array[1][0] # secound Chinese character itself 43 $array[1][1] # its romanized letters 44 45DICTIONARY 46 This module internally uses a mapping table from Hanji to roman which is 47 based on "PY.tit" which is distributed with "cxterm". 48 49MODULE DEPENDENCY 50 Storable module is required. 51 52UTF-8 FLAG 53 This treats utf8 flag transparently. 54 55SEE ALSO 56 Lingua::ZH::Romanize::Cantonese for romanization of Cantonese 57 58 Lingua::JA::Romanize::Japanese for romanization of Japanese 59 60 Lingua::KO::Romanize::Hangul for romanization of Korean 61 62 http://www.kawa.net/works/perl/romanize/romanize-e.html 63 64 http://linuga-romanize.googlecode.com/svn/trunk/Lingua-ZH-Romanize-Pinyi 65 n/ 66 67COPYRIGHT 68 Copyright (c) 2003-2008 Yusuke Kawasaki. All rights reserved. 69 70LICENSE 71 Any commercial use of the Software requires a license directly from the 72 author(s). Please contact the author(s) to negotiate an appropriate 73 license. Commercial use includes integration of all or part of the 74 binary or source code covered by this permission notices into a product 75 for sale or license to third parties on your behalf, or distribution of 76 the binary or source code to third parties that need it to utilize a 77 product sold or licensed on your behalf. 78 79