Skip to content
This repository was archived by the owner on Oct 15, 2022. It is now read-only.

Commit 92a5c59

Browse files
authored
Conversions fix (#4506) (#4580)
* conversions fix * correction
1 parent 9c5af71 commit 92a5c59

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

lib/DDG/Goodie/Conversions.pm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ my $guard = qr/^
103103
(?<question>$question_prefix)\s?
104104
(?<left_num>$factor_re*|\d+\/\d+)\s?(?<left_unit>$keys)
105105
(?:\s
106-
(?<connecting_word>in|(?:convert(?:ed)?)?\s?to|vs|is|convert|per|=(?:[\s\?]+)?|in\sto|(?:equals|is)?\show\smany|(?:equals?(?:\swhat(?:\sin)?)?|make)\sa?|\?\s?=|are\sin\sa|(?:is\swhat\sin)|(?:in to)|from)?\s?
106+
(?<connecting_word>in|(?:convert(?:ed)?)?\s?to|vs|is|convert|per|=(?:[\s\?]+)?|in\sto|(?:equals|is)?\show\smany|(?:equals?(?:\swhat(?:\sin)?)?|make)\sa?|\?\s?=|are\s(?:there)?\s?in\sa?|(?:is\swhat\sin)|(?:in to)|from)?\s?
107107
(?<right_num>$factor_re*|\d+\/\d+)\s?(?:of\s)?(?<right_unit>$keys)\s?
108108
(?:conver(?:sion|ter)|calculator|equals(?:\swhat)?)?[\?]?
109109
)?

t/Conversions.t

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -711,6 +711,22 @@ ddg_goodie_test(
711711
physical_quantity => 'length'
712712
})
713713
),
714+
'how many metres are in 10 yards?' => test_zci(
715+
'', structured_answer => make_answer({
716+
raw_input => '10',
717+
from_unit => 'yard',
718+
to_unit => 'meter',
719+
physical_quantity => 'length'
720+
})
721+
),
722+
'how many metres are there in a mile?' => test_zci(
723+
'', structured_answer => make_answer({
724+
raw_input => '1',
725+
from_unit => 'mile',
726+
to_unit => 'meter',
727+
physical_quantity => 'length'
728+
})
729+
),
714730
'how many cm in a metre?' => test_zci(
715731
'', structured_answer => make_answer({
716732
raw_input => '1',

0 commit comments

Comments
 (0)