return if content dont contain Chinese and result don't contain special Pinyin character (e.g. yes3)
parent
31653a7904
commit
93f0a60e53
|
@ -97,6 +97,14 @@ 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;
|
||||
}
|
||||
}
|
||||
|
||||
return "Pinyin of $_ is \"$result\"",
|
||||
structured_answer => {
|
||||
data => {
|
||||
|
|
|
@ -54,6 +54,7 @@ ddg_goodie_test(
|
|||
# Try to include some examples of queries on which it might
|
||||
# appear that your answer will trigger, but does not.
|
||||
'pinyin ' => undef,
|
||||
'pinyin yes3' => undef,
|
||||
'pinyin how are you?' => undef,
|
||||
'pinyin zhōng guó' => undef,
|
||||
);
|
||||
|
|
Loading…
Reference in New Issue