Conversions: Adding "number of" for question prefix as suggested by @moollaza

master
Rob Emery 2014-10-20 19:43:44 +01:00
parent 6a977c5fc1
commit 883e501cea
2 changed files with 2 additions and 1 deletions

View File

@ -38,7 +38,7 @@ triggers any => @units;
# match longest possible key (some keys are sub-keys of other keys):
my $keys = join '|', reverse sort { length($a) <=> length($b) } @units;
my $question_prefix = qr/(?<prefix>convert|what (?:is|are|does)|how (?:much|many|long) (?:is|are)?)?/;
my $question_prefix = qr/(?<prefix>convert|what (?:is|are|does)|how (?:much|many|long) (?:is|are)?|(?:number of))?/;
# guards and matches regex
my $factor_re = join('|', ('a', 'an', number_style_regex()));

View File

@ -112,6 +112,7 @@ ddg_goodie_test(
'how much is a liter in gallons?' => test_zci('1 litre = 0.264 us gallons', html => '-ANY-'),
'how much is a gallon in litres?' => test_zci('1 us gallon = 3.785 litres', html => '-ANY-'),
'how many gallons in a litre' => test_zci('1 litre = 0.264 us gallons', html => '-ANY-'),
'number of cm in 100 m' => test_zci('100 meters = 10,000 centimeters', html => '-ANY-'),
# Intentionally untriggered
'5 inches in 5 meters' => undef,
'convert 1 cm to 2 mm' => undef,