Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missidentified STREET_TYPE when value occurs in City Name and punctuation is omitted or not provided. #10

Open
kbrackney opened this issue Oct 18, 2013 · 1 comment

Comments

@kbrackney
Copy link

StreetAddress (1.0.5)

Parsing an address that contains words in the city name that also exists in the STREET_TYPES hash produces incorrect results if "punctuation" is not present between the street, city, and state components.

Example:

Correct (where punctuation is provided):
1.9.3p392 :005 > address = StreetAddress::US.parse("120 S Main St, Salt Lake City, UT 84101-1602")
=> 120 S Main St, Salt Lake City, UT 84101-1602

1.9.3p392 :015 > address.street
=> "Main"
1.9.3p392 :016 > address.street_type
=> "St"
1.9.3p392 :017 > address.city
=> "Salt Lake City"

Incorrect (where punctuation is omitted or not available):
1.9.3p392 :006 > address = StreetAddress::US.parse("120 S Main St Salt Lake City UT 84101-1602")
=> 120 S Main St Salt Lk, City, UT 84101-1602

1.9.3p392 :008 > address.street
=> "Main St Salt"
1.9.3p392 :009 > address.street_type
=> "Lk"
1.9.3p392 :010 > address.city
=> "City"

In the case of "Salt Lake City":

Salt becomes part of the street information, Lake is normalized to Lk and becomes the street_type, leaving the value of "City" to occupy the city element. Seems the "hunt" and delineation for STREET_TYPES may be a bit too "greedy" when punctuation is not available.

@jDeppen
Copy link

jDeppen commented Aug 10, 2015

Same here

address = StreetAddress::US.parse("123 Estrada Ave Fort Knox, KY 40121")
=> #<StreetAddress::US::Address:0x007fa9c9f19760 @number="123", @street="Estrada Ave", @street_type="Ft", @unit=nil, @unit_prefix=nil, @suffix=nil, @prefix=nil, @city="Knox", @state="KY", @postal_code="40121", @postal_code_ext=nil>

street: "Estrada Ave" but should be "Estrada"
street_type: "Ft" should be "Ave"
city: "Knox" should be "Fort Knox"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants