Fix micro symbol issue. (#4484)

master
PJ Hampton 2017-09-11 21:35:26 +01:00 committed by Zaahir Moolla
parent 95214cc055
commit 4783cdef4d
3 changed files with 42 additions and 1 deletions

View File

@ -205,6 +205,9 @@ handle query => sub {
$_ =~ s/"/inch/;
$_ =~ s/'/foot/;
# hack around the dropped micro symbol
$_ =~ s/μ/micro/;
if($_ =~ /(\d+)\s*(?:feet|foot)\s*(\d+)(?:\s*inch(?:es)?)?/i){
my $feetHack = $1 + $2/12;
$_ =~ s/(\d+)\s*(?:feet|foot)\s*(\d+)(?:\s*inch(?:es)?)?/$feetHack feet/i;

View File

@ -60,6 +60,9 @@ aliases:
- mcgs
- microgram
- micrograms
- microg
- micro g
- micro grams
type: mass
unit: microgram
symbols: [µg]
@ -368,6 +371,8 @@ aliases:
- micrometers
- micro meter
- micro meters
- microm
- micro m
- µms
- µm
type: length
@ -760,6 +765,8 @@ aliases:
- micro seconds
- micro-second
- micro-seconds
- micros
- micro s
- µs
type: duration
unit: microsecond

View File

@ -2644,7 +2644,38 @@ ddg_goodie_test(
physical_quantity => 'length'
})
),
'nanometer to micron' => test_zci(
'', structured_answer => make_answer({
raw_input => '1',
from_unit => 'nanometer',
to_unit => 'micrometer',
physical_quantity => 'length'
})
),
'nanometer to μm ' => test_zci(
'', structured_answer => make_answer({
raw_input => '1',
from_unit => 'nanometer',
to_unit => 'micrometer',
physical_quantity => 'length'
})
),
'seconds to μs' => test_zci(
'', structured_answer => make_answer({
raw_input => '1',
from_unit => 'second',
to_unit => 'microsecond',
physical_quantity => 'duration'
})
),
'grams to μg' => test_zci(
'', structured_answer => make_answer({
raw_input => '1',
from_unit => 'gram',
to_unit => 'microgram',
physical_quantity => 'mass'
})
),
# natural language queries
'unit converter' => test_zci(