optimize code

master
yhe 2016-07-05 06:57:49 +00:00
parent e21314df4a
commit 17e2f6014b
1 changed files with 3 additions and 7 deletions

View File

@ -97,13 +97,9 @@ handle remainder_lc => sub {
my $result = $h2p->han2pinyin($spacedChineseString);
$result = ConvertTone($result);
# if content dont contain Chinese
if(!(/[\p{Han}]/)){
# and result don't contain special Pinyin character
if ($result !~ m/[āáǎàēéěèīíǐìōóǒòūúǔùǜǘǚǜ]/) {
return;
}
}
# if content doesn't contain Chinese and result doesn't contain special Pinyin character
return if (!(/[\p{Han}]/) and $result !~ m/[āáǎàēéěèīíǐìōóǒòūúǔùǜǘǚǜ]/);
return "Pinyin of $_ is \"$result\"",
structured_answer => {