Chinese Zodiac: Adding support for plural vague terms

master
Rob Emery 2014-10-10 19:58:08 +01:00 committed by Matt Miller
parent ab20f6c8e0
commit b6f61ceedb
2 changed files with 5 additions and 4 deletions

View File

@ -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

View File

@ -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/),