Chinese Zodiac: Adding support for plural vague terms
parent
ab20f6c8e0
commit
b6f61ceedb
|
@ -49,9 +49,9 @@ handle remainder => sub {
|
|||
} elsif (/\b(\d+)\b/) {
|
||||
# Now check for bare years, as we prefer a different start time than the role.
|
||||
$date_gregorian = DateTime->new(year => $1, month => 6,);
|
||||
} elsif (/^$descriptive_datestring_regex$/) {
|
||||
} elsif (/^($descriptive_datestring_regex)([']?[sS]?)$/) {
|
||||
# Now use the role to look for more vague date suggestions
|
||||
$date_gregorian = parse_descriptive_datestring_to_date($_);
|
||||
$date_gregorian = parse_descriptive_datestring_to_date($1);
|
||||
} elsif (/(what|which|animal|current)/) {
|
||||
#Otherwise, default to now if it seems like the user is
|
||||
# asking a question about the current zodiac animal
|
||||
|
|
|
@ -21,8 +21,9 @@ ddg_goodie_test(
|
|||
'2004 chinese zodiac animal' => test_zci('Monkey', html => qr/Monkey/),
|
||||
'what was the chinese zodiac animal in 1992' => test_zci('Monkey', html => qr/Monkey/),
|
||||
'what will the chinese zodiac animal be for 2056' => test_zci('Rat', html => qr/Rat/),
|
||||
'last year\'s chinese zodiac' => test_zci(qr/./, html => qr/./),
|
||||
|
||||
"last year's chinese zodiac" => test_zci(qr/./, html => qr/./),
|
||||
"last years chinese zodiac" => test_zci(qr/./, html => qr/./),
|
||||
|
||||
#Primary example with different query formats
|
||||
'1969 chinese zodiac animal' => test_zci('Rooster', html => qr/Rooster/),
|
||||
'what was the chinese zodiac animal for 1969' => test_zci('Rooster', html => qr/Rooster/),
|
||||
|
|
Loading…
Reference in New Issue