diff options
author | Dave Arter <davea@mysociety.org> | 2015-08-06 15:01:39 +0100 |
---|---|---|
committer | Steven Day <steve@mysociety.org> | 2015-08-13 16:22:24 +0100 |
commit | 5d36f04fae05a24530d387acae43b95007e78e02 (patch) | |
tree | b94ba5806a7b3cb42118d4f9a3e46a3df20f4399 | |
parent | c52bedd4b1f68ed1c22ad034135dc743d419b7b0 (diff) |
[Bromley] Add more disambiguation rules for geocoder
Also tidies up some repeated regexes
Fixes #1176
-rw-r--r-- | perllib/FixMyStreet/Cobrand/Bromley.pm | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/perllib/FixMyStreet/Cobrand/Bromley.pm b/perllib/FixMyStreet/Cobrand/Bromley.pm index 9bee45128..fbf831eb6 100644 --- a/perllib/FixMyStreet/Cobrand/Bromley.pm +++ b/perllib/FixMyStreet/Cobrand/Bromley.pm @@ -20,12 +20,16 @@ sub disambiguate_location { my $town = 'Bromley'; + # Helpful regexes that are used often + my $road = 'r(?:oa)?d'; + my $street = 'st(\.|reet)?'; + # Bing turns High St Bromley into Bromley High St which is in # Bromley by Bow. - $town .= ', BR1' if $string =~ /^high\s+st(reet)?$/i; + $town .= ', BR1' if $string =~ /^high\s+${street}$/i; # Disambiguations required for BR5 - $town .= ', BR5' if $string =~ /^kelsey\s+r(?:oa)?d$/i; + $town .= ', BR5' if $string =~ /^kelsey\s+${road}$/i; $town = 'BR5 Bromley' if $string =~ /^leith\s+hill$/i; # doesn't like appended BR5 for some reason # There has also been a road name change for a section of Ramsden Road @@ -38,9 +42,17 @@ sub disambiguate_location { $town = ', BR6 0PL'; } $town .= ', BR5' if $string =~ /^meadway/i; + $town .= ', BR5' if $string =~ /^mill\s+brook\s+${road}$/i; + $town .= ', BR5' if $string =~ /^kent\s+${road}$/i; + $town .= ', BR5' if $string =~ /^the\s+landway$/i; + $town .= ', BR5' if $string =~ /^mountfield\s+way$/i; + $town .= ', BR5 3' if $string =~ /^star\s+lane$/i; + $town .= ', BR5 4AX' if $string =~ /^high\s+${street}?(,)?\s?st\.?\s+mary\s+cray$/i; # and BR6 $town .= ', BR6' if $string =~ /^berrylands/i; + $town .= ', BR6' if $string =~ /^crofton\s+${road}$/i; + $town .= ', BR6' if $string =~ /^crofton\s+lane$/i; # White Horse Hill is on boundary with Greenwich, so need a # specific postcode |