eGuideDog::Dict::Mandarin - an informal Pinyin dictionary.


eGuideDog-Dict-Mandarin documentation  | view source Contained in the eGuideDog-Dict-Mandarin distribution.

Index


NAME

Top

eGuideDog::Dict::Mandarin - an informal Pinyin dictionary.

SYNOPSIS

Top

  use utf8;
  use eGuideDog::Dict::Mandarin;

  binmode(stdout, 'utf8');
  my $dict = eGuideDog::Dict::Mandarin->new();
  my @symbols = $dict->get_multi_phon("长");
  print "长(all pronunciation):@symbols\n"; # zhang3 chang2
  my $symbol = $dict->get_pinyin("长");
  print "长(default pronunciation): $symbol\n"; # zhang3
  $symbol = $dict->get_pinyin("长江");
  print "长江的长: $symbol\n"; # chang2
  my @symbols = $dict->get_pinyin("拼音");
  print "拼音: @symbols\n"; # pin1 yin1
  my @words = $dict->get_words("长");
  print "Some words begin with 长: @words\n";

DESCRIPTION

Top

This module is for looking up Pinyin of Mandarin characters or words. The dictionary is from Mandarin dictionary of espeak (http://espeak.sf.net).

The Mandarin pronunciation dictionary included with eSpeak is a compact summary of data from CEDICT and Unihan, with some corrections. Rather than include every word in the language, it includes only words that are pronounced differently from the default pronunciations of their component characters (which are also included).

EXPORT

None by default.

METHODS

Top

new()

Initialize dictionary.

get_pinyin($str)

Return an array of Pinyin phonetic symbols of all characters in $str if it is in an array context.

Return a string of Pinyin phonetic symbol of the first character if it is not in an array context.

get_words($char)

Return an array of words which are begun with $char.

is_multi_phon($char)

Return non-zero if $char is a multi-phonetic-symbol character. The returned value plus 1 is the number of phonetic symbols the character has.

Return 0 if $char is single-phonetic-symbol character.

get_multi_phon($char)

Return an array of phonetic symbols of $char.

SEE ALSO

Top

eGuideDog::Dict::Cantonese, http://e-guidedog.sf.net

AUTHOR

Top

Cameron Wong, <hgn823-perl at yahoo.com.cn>

ACKNOWLEDGMENT

Top

Thanks to Silas S. Brown (http://people.pwf.cam.ac.uk/ssb22/) for maintaining the Mandarin dictionary file of espeak.

COPYRIGHT AND LICENSE

Top


eGuideDog-Dict-Mandarin documentation  | view source Contained in the eGuideDog-Dict-Mandarin distribution.