pickware / address-splitter

Tries to split street, number, building, apartment information etc. in a meaningful way
MIT License
98 stars 21 forks source link

(French) Errors in address splitting with numbered streets #24

Closed arinstar closed 5 years ago

arinstar commented 5 years ago

Hello,

When using this package to split French-language addresses, the following issue arises:

As stated in the docs, the street address 13 2ème Avenue will split correctly, and put 13 in houseNumber and 2ème Avenue in streetName.

array:5 [▼ "additionToAddress1" => "" "streetName" => "2ème Avenue" "houseNumber" => "13" "houseNumberParts" => array:2 [▼ "base" => "13" "extension" => "" ] "additionToAddress2" => "" ]

However, an issue arises when the shorter notation 13 2e Avenue is used. 13 2e will be flagged as houseNumber, in 2 parts. See the output below, from Laravel's dd() instruction :

Returned data: array:5 [▼ "additionToAddress1" => "" "streetName" => "Avenue" "houseNumber" => "13 2e " "houseNumberParts" => array:2 [▼ "base" => "13" "extension" => "2e" ] "additionToAddress2" => "" ]

Expected data: array:5 [▼ "additionToAddress1" => "" "streetName" => "2e Avenue" "houseNumber" => "13" "houseNumberParts" => array:2 [▼ "base" => "13" "extension" => "" ] "additionToAddress2" => "" ]

Here's an example of this address notation in Montreal, Canada: https://www.google.com/maps/place/10e+Avenue,+Montr%C3%A9al,+QC/@45.5684289,-73.6242512,17z/data=!3m1!4b1!4m5!3m4!1s0x4cc91ed619691d27:0xd632287a8544ba86!8m2!3d45.5684252!4d-73.6220625

The shorter notation is what's typically provided by GIS systems which we have to validate against.

svenmuennich commented 5 years ago

Thanks for the detailed issue description. This looks like a duplicate of #12. I added your example there.