street-address-rb / street-address

Detect, and dissect, US Street Addresses in strings.
MIT License
168 stars 85 forks source link

Doesn't Handle Abbreviated Directional Street Names Well #12

Closed apbendi closed 9 years ago

apbendi commented 10 years ago

Street names with directions (North, South, East, West) are often abbreviated with a single letter, or with a single letter and a dot. It seems to me that parse should return the same normalized address regardless of the input format, but this is not the case. For example:

> StreetAddress::US.parse("555 North Fake Street", :informal=>true)
 => 555 N Fake St
> StreetAddress::US.parse("555 N. Fake Street", :informal=>true)
 => 555 N. Fake St
> StreetAddress::US.parse("555 N Fake Street", :informal=>true)
 => 555 N Fake St

Note that if a dot is included, the dot is left. Whereas if the dot is not included, or the full directional name is provided, the result is an abbreviation without the dot. In my opinion, the dotted version should normalize to the non dotted version, thus:

> StreetAddress::US.parse("555 N. Fake Street", :informal=>true)
 => 555 N Fake St
derrek commented 9 years ago

Fixed with version 2

apbendi commented 9 years ago

:+1: blast from the past!