Skip to content

Commit

Permalink
A bit more on the POC
Browse files Browse the repository at this point in the history
  • Loading branch information
nigelhorne committed Apr 8, 2024
1 parent 4b6969f commit f9c37e4
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion lib/Geo/Coder/Free.pm
Original file line number Diff line number Diff line change
Expand Up @@ -207,11 +207,19 @@ sub geocode {
if($w =~ /^[a-z]{2,}$/i) {
my $peek = $iterator->peek();
last if(!defined($peek));
my $offset;
if(exists($common_words{lc($peek)})) {
$peek = $iterator->peek(2);
last if(!defined($peek));
$offset = 3;
} else {
$offset = 2;
}
my $s;
if((length($peek) == 2) && (Locale::US->new()->{code2state}{uc($peek)})) {
$s = "$w $peek US";
} else {
my $peekpeek = $iterator->peek(2);
my $peekpeek = $iterator->peek($offset);
last if(!defined($peekpeek));
$s = "$w $peek $peekpeek";
}
Expand Down

0 comments on commit f9c37e4

Please sign in to comment.