Skip to content

Commit

Permalink
Local.pm: Call _normalize when libpostal is installed
Browse files Browse the repository at this point in the history
  • Loading branch information
nigelhorne committed Oct 9, 2020
1 parent 824add2 commit 1e9a7c9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 28 deletions.
3 changes: 3 additions & 0 deletions Changes
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
Revision history for Geo-Coder-Free

0.27
Local.pm: Call _normalize when libpostal is installed

0.26 Thu Oct 8 19:47:45 EDT 2020
Create the MaxMind database directory to download to
Use Geo::Coder::Abbreviations
Expand Down
29 changes: 1 addition & 28 deletions lib/Geo/Coder/Free/Local.pm
Original file line number Diff line number Diff line change
Expand Up @@ -295,34 +295,7 @@ sub geocode {
}
$addr{'location'} = $location;
if(my $street = $addr{'road'}) {
$street = uc($street);
if($street =~ /(.+)\s+STREET$/) {
$street = "$1 ST";
} elsif($street =~ /(.+)\s+ROAD$/) {
$street = "$1 RD";
} elsif($street =~ /(.+)\s+AVENUE$/) {
$street = "$1 AVE";
} elsif($street =~ /(.+)\s+AVENUE\s+(.+)/) {
$street = "$1 AVE $2";
} elsif($street =~ /(.+)\s+COURT$/) {
$street = "$1 CT";
} elsif($street =~ /(.+)\s+CIRCLE$/) {
$street = "$1 CIR";
} elsif($street =~ /(.+)\s+DRIVE$/) {
$street = "$1 DR";
} elsif($street =~ /(.+)\s+PARKWAY$/) {
$street = "$1 PKWY";
} elsif($street =~ /(.+)\s+GARDENS$/) {
$street = "$1 GRDNS";
} elsif($street =~ /(.+)\s+LANE$/) {
$street = "$1 LN";
} elsif($street =~ /(.+)\s+PLACE$/) {
$street = "$1 PL";
} elsif($street =~ /(.+)\s+CREEK$/) {
$street = "$1 CRK";
}
$street =~ s/^0+//; # Turn 04th St into 4th St
$addr{'road'} = $street;
$addr{'road'} = Geo::Coder::Free::_normalize($street);
}
if(defined($addr{'state'}) && !defined($addr{'country'}) && ($addr{'state'} eq 'england')) {
delete $addr{'state'};
Expand Down

0 comments on commit 1e9a7c9

Please sign in to comment.