| 1 | package Unicode::Collate::CJK::Pinyin; | ||||||||||
| 2 | |||||||||||
| 3 | 4 | ▶ | use 5.006; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 4 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 4 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | |||||||||||
| 7 | 4 | our $VERSION = '1.31'; | |||||||||
| 8 | |||||||||||
| 9 | 4 | my %u2p; | |||||||||
| 10 | 4 | my $wt = 0x8000; | |||||||||
| 11 | |||||||||||
| 12 | 4 | ▶ | while (<DATA>) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 13 | 11868 | ▶ | last if /^__END__/; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 14 | 11864 | my @c = split; | |||||||||
| 15 | 11864 | for my $c (@c) { | |||||||||
| 16 | 83664 | ▶ | next if !$c; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 17 | 83664 | ▶ | $u2p{hex($c)} = $wt if $c !~ /-/; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 18 | 83664 | $wt++; | |||||||||
| 19 | } | ||||||||||
| 20 | } | ||||||||||
| 21 | |||||||||||
| 22 | 1989 | ▶ | sub weightPinyin { | ||||||||
|
Subroutine
weightPinyin: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||
| 23 | 1989 | my $u = shift; | |||||||||
| 24 | 1989 | ▶ | return exists $u2p{$u} ? $u2p{$u} : undef; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 25 | } | ||||||||||
| 26 | |||||||||||
| 27 | 4 | 1; | |||||||||
| 28 | __DATA__ | ||||||||||