blib/lib/eGuideDog/Dict/Mandarin.pm

filter: Statementstmt 70.2% 158 / 225 Branchbran 70.2% 52 / 74 Conditioncond 30.0% 3 / 10 MC/DCmcdc 16.6% 1 / 6 Subroutinesub 70.0% 14 / 20 Podpod 40.0% 6 / 15 totaltotal 66.8% 234 / 350 CC 54 SCAR 30.1
CC
54
Cov
69%
print_phon_char_list
90.0
get_pinyin
22.1
import_zh_list
13.7
CRAP 20.3
↑ Summary update_dict.pl »
1 package eGuideDog::Dict::Mandarin;
2  
3 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 3 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 3 ▶use Encode::CNMap;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 3 ▶use Storable;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 3 require Exporter;
10  
11 3 our @ISA = qw(Exporter);
12  
13 # Items to export into callers namespace by default. Note: do not export
14 # names by default without a very good reason. Use EXPORT_OK instead.
15 # Do not simply export all your public functions/methods/constants.
16  
17 # This allows declaration use eGuideDog::Dict::Mandarin ':all';
18 # If you do not need this, moving things directly into @EXPORT or @EXPORT_OK
19 # will save memory.
20 3 our %EXPORT_TAGS = ( 'all' => [ qw(
21
22 ) ] );
23  
24 3 our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );
25  
26 3 our @EXPORT = qw(
27
28 );
29  
30 3 our $VERSION = '0.5';
31  
32  
33 # Preloaded methods go here.
34  
35 1 ▶sub new() {
Subroutine new: called CC=2 SCAR=6.9
Pod documented
36 1 my $self = {};
37 1 $self->{pinyin} = {}; # The most probably phonetic symbol
38 1 $self->{chars} = {}; # all phonetic symbols (array ref)
39 1 $self->{words} = {}; # word phonetic symbols (array ref)
40 1 $self->{word_index} = {}; # the first char to words (array ref)
41 1 $self->{char_rate} = {};
42 1 bless $self, __PACKAGE__;
43  
44 # load dictionary file.
45 1 my $dir = __FILE__;
46 1 $dir =~ s/[.]pm$//;
47  
48 1 ▶ if(-e "$dir/Mandarin.dict") {
Branch: 1 branch
BranchTrueFalseTotal
if (-e "$dir/Mandarin.dict") 1 0 1
49 1 my $dict = retrieve("$dir/Mandarin.dict");
50 1 $self->{pinyin} = $dict->{pinyin};
51 1 $self->{chars} = $dict->{chars};
52 1 $self->{words} = $dict->{words};
53 1 $self->{word_index} = $dict->{word_index};
54 1 $self->{char_rate} = $dict->{char_rate};
55 1 $self->{symbol_size} = $dict->{symbol_size};
56 }
57  
58 1 return $self;
59 }
60  
61 0 ▶sub update_symbol_size {
Subroutine update_symbol_size: not called CC=3 SCAR=24.8
Pod undocumented
62 0 my ($self) = @_;
63 0 my $all = "a ai an ang ao ba bai ban bang bao bei ben beng bi bian biao bie bin bing bo bu ca cai can cang cao ce cen ceng cha chai chan chang chao che chen cheng chi chong chou chu chua chuai chuan chuang chui chun chuo ci cong cou cu cuan cui cun cuo da dai dan dang dao de dei den deng di dia dian diao die ding diu dong dou du duan dui dun duo e ei en eng er fa fan fang fei fen feng fo fou fu ga gai gan gang gao ge gei gen geng gong gou gu gua guai guan guang gui gun guo ha hai han hang hao he hei hen heng hong hou hu hua huai huan huang hui hun huo ji jia jian jiang jiao jie jin jing jiong jiu ju juan jue jun ka kai kan kang kao ke kei ken keng kong kou ku kua kuai kuan kuang kui kun kuo la lai lan lang lao le lei leng li lia lian liang liao lie lin ling liu lo long lou lu lu: luan lu:e lun luo ma mai man mang mao me mei men meng mi mian miao mie min ming miu mo mou mu na nai nan nang nao ne nei nen neng ng ni nia nian niang niao nie nin ning niu nong nou nu nu: nuan nu:e nuo o ou pa pai pan pang pao pei pen peng pi pian piao pie pin ping po pou pu qi qia qian qiang qiao qie qin qing qiong qiu qu quan que qun ran rang rao re ren reng ri rong rou ru rua ruan rui run ruo sa sai san sang sao se sen seng sha shai shan shang shao she shei shen sheng shi shou shu shua shuai shuan shuang shui shun shuo si song sou su suan sui sun suo ta tai tan tang tao te teng ti tian tiao tie ting tong tou tu tuan tui tun tuo wa wai wan wang wei wen weng wo wu xi xia xian xiang xiao xie xin xing xiong xiu xu xuan xue xun ya yan yang yao ye yi yin ying yo yong you yu yuan yue yun za zai zan zang zao ze zei zen zeng zha zhai zhan zhang zhao zhe zhei zhen zheng zhi zhong zhou zhu zhua zhuai zhuan zhuang zhui zhun zhuo zi zong zou zu zuan zui zun zuo";
64 0 $all =~ s/u:/v/g;
65 0 my @all_pinyin = split(' ', $all);
66  
67 0 foreach my $py (@all_pinyin) {
68 0 for (1 .. 5) {
69 0 my $pytone = $py . $_;
70 0 system("espeak -vzh \"$pytone\" -w /tmp/espeak_size.1");
71 0 system("espeak -vzh \"$pytone$pytone\" -w /tmp/espeak_size.2");
72 0 my $size = (-s '/tmp/espeak_size.2') - (-s '/tmp/espeak_size.1');
73 0 $self->{symbol_size}->{$pytone} = $size;
74 }
75 }
76 }
77  
78 1 ▶sub import_symbol_size {
Subroutine import_symbol_size: called CC=2 SCAR=6.9
Pod undocumented
79 1 my ($self, $file) = @_;
80 1 open(SYMBOL_SIZE, '<', $file);
81 1 ▶ while (<SYMBOL_SIZE>) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined($_ = readline SYMBOL_SIZE)) 2060 1 2061
82 2060 my @pair = split(/\s/, $_);
83 2060 $self->{symbol_size}->{$pair[0]} = $pair[1];
84 }
85 1 close(SYMBOL_SIZE);
86 }
87  
88 0 ▶sub get_symbol_size {
Subroutine get_symbol_size: not called CC=2 SCAR=17.9
Pod undocumented
89 0 my ($self, $symbol) = @_;
90 0 ▶ if ($self->{symbol_size}->{$symbol}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'symbol_size'}{$symbol}) { } 0 0 0
91 0 return $self->{symbol_size}->{$symbol};
92 } else {
93 0 warn "$symbol size not exist";
94 0 return undef;
95 }
96 }
97  
98 0 ▶sub print_symbol_size_list {
Subroutine print_symbol_size_list: not called CC=2 SCAR=17.9
Pod undocumented
99 0 my ($self) = @_;
100 0 foreach (sort(keys %{$self->{symbol_size}})) {
101 0 print $_, "\t", $self->{symbol_size}->{$_}, "\n";
102 }
103 }
104  
105 1 ▶sub update_dict {
Subroutine update_dict: called CC=1 SCAR=0.0
Pod undocumented
106 1 my $self = shift;
107  
108 1 $self->{pinyin} = {};
109 1 $self->{chars} = {};
110 1 $self->{words} = {};
111 1 $self->{word_index} = {};
112 1 $self->{char_rate} = {};
113  
114 1 $self->import_unihan("HanyuPinlu.txt");
115 # if a character is not exist in HanyuPinlu, it will look up in Mandarin.txt.
116 1 $self->import_unihan("Mandarin.txt");
117 1 $self->import_zh_list("zh_list");
118 1 $self->import_zh_list("zh_listx");
119 1 $self->import_char_rate("HanyuPinlu.txt");
120 1 $self->import_symbol_size("symbol_size_list");
121  
122 my $dict = {pinyin => $self->{pinyin},
123 chars => $self->{chars},
124 words => $self->{words},
125 word_index => $self->{word_index},
126 char_rate => $self->{char_rate},
127 symbol_size => $self->{symbol_size},
128 1 };
129 1 store($dict, "Mandarin.dict");
130 }
131  
132 1 ▶sub import_char_rate {
Subroutine import_char_rate: called CC=3 SCAR=11.0
Pod undocumented
133 1 my ($self, $file) = @_;
134 1 open(DATA_FILE, '<', $file);
135 1 ▶ while(my $line = <DATA_FILE>) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined(my $line = readline DATA_FILE)) 3799 1 3800
136 3799 chomp($line);
137 3799 my @items = split(/\s+/, $line);
138 3799 my $rate = 0;
139 3799 foreach (@items[1 .. $#items]) {
140 4324 /\((.*)\)/;
141 4324 $rate += $1;
142 }
143 3799 my $char = chr(hex($items[0]));
144 3799 $self->{char_rate}->{$char} = $rate;
145 # my $char_simp = utf8_to_simputf8($char);
146 # if ($char_simp !~ /[?]/) {
147 # $self->{char_rate}->{$char_simp} = $rate;
148 # }
149 # my $char_trad = utf8_to_tradutf8($char);
150 # if ($char_trad !~ /[?]/) {
151 # $self->{char_rate}->{$char_trad} = $rate;
152 # }
153 }
154 1 close(DATA_FILE);
155 }
156  
157 2 ▶sub import_unihan {
Subroutine import_unihan: called CC=8 SCAR=20.8
Pod undocumented
158 2 my ($self, $file) = @_;
159 2 open(DATA_FILE, '<', $file);
160 2 ▶ while(my $line = <DATA_FILE>) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined(my $line = readline DATA_FILE)) 29276 2 29278
161 29276 chomp($line);
162 29276 $line = lc($line); # specific to Mandarin.txt
163 29276 my @items = split(/\s+/, $line);
164 29276 s/\(.*\)// foreach (@items); # specific to HanyuPinlu
165 29276 my $char = chr(hex($items[0]));
166 29276 my @phons = @items[1 .. $#items];
167 29276 ▶ if (not defined $self->{chars}->{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self->{"chars"}{$char}) 23033 6243 29276
168 23033 $self->{chars}->{$char} = \@phons;
169 }
170 29276 my $char_simp = utf8_to_simputf8($char);
171 29276 ▶ if ($char_simp !~ /[?]/) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($char_simp =~ /[?]/) 16423 12853 29276
172 16423 ▶ if (!defined $self->{chars}->{$char_simp}) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self->{"chars"}{$char_simp}) 1350 15073 16423
173 1350 $self->{chars}->{$char_simp} = \@phons;
174 }
175 }
176 29276 my $char_trad = utf8_to_tradutf8($char);
177 29276 ▶ if ($char_trad !~ /[?]/) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($char_trad =~ /[?]/) 19495 9781 29276
178 19495 ▶ if (!defined $self->{chars}->{$char_trad}) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self->{"chars"}{$char_trad}) 1162 18333 19495
179 1162 $self->{chars}->{$char_trad} = \@phons;
180 }
181 }
182 }
183 2 close(DATA_FILE);
184 }
185  
186 177731 ▶sub add_symbol {
Subroutine add_symbol: called CC=4 SCAR=13.9
Pod undocumented
187 177731 my ($self, $char, $symbol) = @_;
188  
189 177731 ▶ if (not $self->{chars}->{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $self->{'chars'}{$char}) { } 82 177649 177731
190 82 $self->{chars}->{$char} = [$symbol];
191 82 return 1;
192 } else {
193 177649 foreach (@{$self->{chars}->{$char}}) {
194 279384 ▶ if ($symbol eq $_) {
Branch: 1 branch
BranchTrueFalseTotal
if ($symbol eq $_) 176550 102834 279384
195 176550 return 0;
196 }
197 }
198 1099 $self->{chars}->{$char} = [@{$self->{chars}->{$char}}, $symbol];
199 1099 return 1;
200 }
201 }
202  
203 2 ▶sub import_zh_list {
Subroutine import_zh_list: called CC=13 SCAR=26.2
Pod undocumented
204 2 my ($self, $zh_list) = @_;
205  
206 2 open(ZH_LIST, '<:utf8', $zh_list);
207 2 ▶ while (my $line = <ZH_LIST>) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined(my $line = readline ZH_LIST)) 85606 2 85608
208 85606 ▶ if ($line =~ /^(.)\s([^\s]*)\s$/) {
Branch: 2 branches
BranchTrueFalseTotal
if ($line =~ /^(.)\s([^\s]*)\s$/) { } 25473 60133 85606
elsif ($line =~ /^[(]([^)]*)[)]\s([^\s]*)\s$/) { } 60108 25 60133
209 25473 ▶ if ($1 && $2) {
Branch: 1 branch
BranchTrueFalseTotal
if ($1 and $2) 25473 0 25473
Condition33%1/3
$1 and $2
!ll&&!rl&&r
0025473
MC/DC0%0/2
$1 and $2
$1 $2
Truth table33%1/3
A and B
A= $1B= $2
ABresult
0X0
100
111
210 25473 my $ch = $1;
211 25473 my $py = $2;
212 25473 ▶ if ($py =~ /^[a-z]*[1-5]$/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($py =~ /^[a-z]*[1-5]$/) 25410 63 25473
213 25410 $self->{pinyin}->{$ch} = $py;
214 25410 $self->add_symbol($ch, $py);
215 }
216 }
217 } elsif ($line =~ /^[(]([^)]*)[)]\s([^\s]*)\s$/) {
218 60108 my @chars = split(/ /, $1);
219 60108 my $phon = $2;
220 60108 my @symbols;
221 60108 ▶ if ($phon =~ /[|]/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($phon =~ /[|]/) { } 0 60108 60108
222 0 @symbols = split(/[|]/, $phon);
223 } else {
224 60108 ▶ while($phon && $phon =~ /^([a-z]*[0-9])(.*)/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($phon and $phon =~ /^([a-z]*[0-9])(.*)/) 152321 60108 212429
Condition66%2/3
$phon and $phon =~ /^([a-z]*[0-9])(.*)/
!ll&&!rl&&r
601080152321
MC/DC50%1/2
$phon and $phon =~ /^([a-z]*[0-9])(.*)/
$phon $phon =~ /^([a-z]*[0-9])(.*)/
Truth table66%2/3
A and B
A= $phonB= $phon =~ /^([a-z]*[0-9])(.*)/
ABresult
0X0
100
111
225 152321 push(@symbols, $1);
226 152321 $phon = $2;
227 }
228 }
229 60108 ▶ if ($#chars != $#symbols) {
Branch: 1 branch
BranchTrueFalseTotal
if ($#chars != $#symbols) 0 60108 60108
230 0 warn "Dictionary error:" . "@chars" . "-" . "@symbols";
231 0 next;
232 }
233 60108 my $word = join("", @chars);
234 60108 ▶ if ($self->{word_index}->{$chars[0]}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'word_index'}{$chars[0]}) { } 57508 2600 60108
235 57508 push(@{$self->{word_index}->{$chars[0]}}, $word);
236 } else {
237 2600 $self->{word_index}->{$chars[0]} = [$word];
238 }
239 60108 $self->{words}->{$word} = \@symbols;
240 60108 ▶ for (my $i = 0; $i <= $#chars; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#chars) 152321 60108 212429
241 152321 $self->add_symbol($chars[$i], $symbols[$i]);
242 }
243 }
244 }
245 2 close(ZH_LIST);
246 }
247  
248 3 ▶sub get_pinyin {
Subroutine get_pinyin: called CC=14 SCAR=30.9
Pod documented
249 3 my ($self, $str) = @_;
250  
251 3 ▶ if (not utf8::is_utf8($str)) {
Branch: 2 branches
BranchTrueFalseTotal
if (not utf8::is_utf8($str)) { } 0 3 3
elsif (not $str) { } 0 3 3
252 0 ▶ if (not utf8::decode($str)) {
Branch: 1 branch
BranchTrueFalseTotal
unless (utf8::decode($str)) 0 0 0
253 0 warn "$str is not in utf8 encoding.";
254 0 return undef;
255 }
256 } elsif (not $str) {
257 0 return undef;
258 }
259  
260 3 ▶ if (wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (wantarray) { } 1 2 3
261 1 my @pinyin;
262 1 ▶ for (my $i = 0; $i < length($str); $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i < length $str) 2 1 3
263 2 my $char = substr($str, $i, 1);
264 2 my @words = $self->get_words($char);
265 2 my $longest_word = '';
266 2 foreach my $word (@words) {
267 8 ▶ if (index($str, $word) == 0) {
Branch: 1 branch
BranchTrueFalseTotal
if (index($str, $word) == 0) 0 8 8
268 0 ▶ if (length($word) > length($longest_word)) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $word > length $longest_word) 0 0 0
269 0 $longest_word = $word;
270 }
271 }
272 }
273 2 ▶ if ($longest_word) {
Branch: 1 branch
BranchTrueFalseTotal
if ($longest_word) { } 0 2 2
274 0 push(@pinyin, @{$self->{words}->{$longest_word}});
275 0 $i += $#{$self->{words}->{$longest_word}};
276 } else {
277 2 push(@pinyin, $self->{pinyin}->{$char});
278 }
279 }
280 1 return @pinyin;
281 } else {
282 2 my $char = substr($str, 0, 1);
283 2 my @words = $self->get_words($char);
284 2 my $longest_word = '';
285 2 foreach my $word (@words) {
286 184 ▶ if (index($str, $word) == 0) {
Branch: 1 branch
BranchTrueFalseTotal
if (index($str, $word) == 0) 1 183 184
287 1 ▶ if (length($word) > length($longest_word)) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $word > length $longest_word) 1 0 1
288 1 $longest_word = $word;
289 }
290 }
291 }
292 2 ▶ if ($longest_word) {
Branch: 1 branch
BranchTrueFalseTotal
if ($longest_word) { } 1 1 2
293 1 return $self->{words}->{$longest_word}->[0];
294 } else {
295 1 return $self->{pinyin}->{$char};
296 }
297 }
298 }
299  
300 5 ▶sub get_words {
Subroutine get_words: called CC=2 SCAR=7.4
Pod documented
301 5 my ($self, $char) = @_;
302  
303 5 ▶ if ($self->{word_index}->{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'word_index'}{$char}) { } 5 0 5
304 5 return @{$self->{word_index}->{$char}};
305 } else {
306 0 return ();
307 }
308 }
309  
310 0 ▶sub is_multi_phon {
Subroutine is_multi_phon: not called CC=1 SCAR=6.9
Pod documented
311 0 my ($self, $char) = @_;
312 0 return $#{$self->{chars}->{$char}};
313 }
314  
315 0 ▶sub get_multi_phon {
Subroutine get_multi_phon: not called CC=2 SCAR=17.9
Pod documented
316 0 my ($self, $char) = @_;
317 0 ▶ if ($self->{chars}->{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'chars'}{$char}) { } 0 0 0
318 0 return @{$self->{chars}->{$char}};
319 } else {
320 0 return undef;
321 }
322 }
323  
324 0 ▶sub print_phon_char_list {
Subroutine print_phon_char_list: not called CC=9 SCAR=45.0
Pod documented
325 0 my ($self, $char) = @_;
326 0 my $all = "a ai an ang ao ba bai ban bang bao bei ben beng bi bian biao bie bin bing bo bu ca cai can cang cao ce cen ceng cha chai chan chang chao che chen cheng chi chong chou chu chua chuai chuan chuang chui chun chuo ci cong cou cu cuan cui cun cuo da dai dan dang dao de dei den deng di dia dian diao die ding diu dong dou du duan dui dun duo e ei en eng er fa fan fang fei fen feng fo fou fu ga gai gan gang gao ge gei gen geng gong gou gu gua guai guan guang gui gun guo ha hai han hang hao he hei hen heng hong hou hu hua huai huan huang hui hun huo ji jia jian jiang jiao jie jin jing jiong jiu ju juan jue jun ka kai kan kang kao ke kei ken keng kong kou ku kua kuai kuan kuang kui kun kuo la lai lan lang lao le lei leng li lia lian liang liao lie lin ling liu lo long lou lu lu: luan lu:e lun luo ma mai man mang mao me mei men meng mi mian miao mie min ming miu mo mou mu na nai nan nang nao ne nei nen neng ng ni nia nian niang niao nie nin ning niu nong nou nu nu: nuan nu:e nuo o ou pa pai pan pang pao pei pen peng pi pian piao pie pin ping po pou pu qi qia qian qiang qiao qie qin qing qiong qiu qu quan que qun ran rang rao re ren reng ri rong rou ru rua ruan rui run ruo sa sai san sang sao se sen seng sha shai shan shang shao she shei shen sheng shi shou shu shua shuai shuan shuang shui shun shuo si song sou su suan sui sun suo ta tai tan tang tao te teng ti tian tiao tie ting tong tou tu tuan tui tun tuo wa wai wan wang wei wen weng wo wu xi xia xian xiang xiao xie xin xing xiong xiu xu xuan xue xun ya yan yang yao ye yi yin ying yo yong you yu yuan yue yun za zai zan zang zao ze zei zen zeng zha zhai zhan zhang zhao zhe zhei zhen zheng zhi zhong zhou zhu zhua zhuai zhuan zhuang zhui zhun zhuo zi zong zou zu zuan zui zun zuo";
327 0 $all =~ s/u:/v/g;
328 0 my @all_pinyin = split(' ', $all);
329  
330 0 my %phonh;
331 0 foreach my $char (keys %{$self->{chars}}) {
332 0 my $phons = $self->{chars}->{$char};
333 0 foreach my $phon (@{$phons}) {
334 0 ▶ if ($phonh{$phon}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($phonh{$phon}) { } 0 0 0
335 0 push(@{$phonh{$phon}}, $char);
336 } else {
337 0 my @p = ($char);
338 0 $phonh{$phon} = \@p;
339 }
340 }
341 }
342 0 foreach my $py (@all_pinyin) {
343 0 for (1 .. 5) {
344 0 my $pytone = $py . $_;
345 0 ▶ if ($phonh{$pytone}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($phonh{$pytone}) { } 0 0 0
346 0 my @p1 = @{$phonh{$pytone}};
347 0 ▶ my @p2 = sort {($self->{char_rate}->{$b} || 0) <=> ($self->{char_rate}->{$a} || 0)} @p1;
Condition0%0/4
$self->{'char_rate'}{$b} || 0
l!l
00
$self->{'char_rate'}{$a} || 0
l!l
00
MC/DC0%0/1
$self->{'char_rate'}{$b} || 0
$self->{'char_rate'}{$b}
MC/DC0%0/1
$self->{'char_rate'}{$a} || 0
$self->{'char_rate'}{$a}
Truth table0%0/2
A
A= $self->{'char_rate'}{$b}
Aresult
11
00
Truth table0%0/2
A
A= $self->{'char_rate'}{$a}
Aresult
11
00
348 0 print "$pytone: @p2\n";
349 # foreach (@p2) {
350 # print $_, "(", $self->{char_rate}->{$_} || 0, ") ";
351 # }
352 # print "\n";
353 } else {
354 0 print "$pytone:\n";
355 }
356 }
357 }
358 }
359  
360 3 1;
361 __END__
↑ Summary update_dict.pl »