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

Street addresses ending in "Ct" parsing inaccurately #48

Open
JustinMcDonald opened this issue Apr 23, 2019 · 3 comments
Open

Street addresses ending in "Ct" parsing inaccurately #48

JustinMcDonald opened this issue Apr 23, 2019 · 3 comments

Comments

@JustinMcDonald
Copy link

It is assuming "Ct" is a state, and parsing the rest of the string accordingly:

> StreetAddress::US.parse_address("122 Blueberry Ct").to_s
=> "12 2, Blueberry, CT"

Similarly, if a street address ends with a street name that is also a state, it will make the same assumption:

> StreetAddress::US.parse("122 N Virginia").to_s
=> "12 2, N, VA"

It might be more accurate to look at the number of word parts before looking for state, and/or make an exception for "Ct" in combination with number of word parts.

@JustinMcDonald
Copy link
Author

To be more specific, it looks like an address like "122 Blueberry Ct" is matching the formal address regex since "Ct" is matching the state list.

Same goes with the "Virginia" example above. These addresses should probably not match the formal address regex, and be treated as informal.

@jsmith613
Copy link

change line 668 to
( # special case for Connecticut (CT) (?=.*#{street_type_regexp}.*CT.*) #{street_regexp}\W+(?=.*CT) | #{street_regexp}\W+ )

@jsmith613
Copy link

This is also a problem with KY, LA, and MT
( # special case for Connecticut (CT) (?=.*#{street_type_regexp}.*(CT|KY|LA|MT).*) #{street_regexp}\W+(?=.*(CT|KY|LA|MT).) | #{street_regexp}\W+ )

This was referenced Dec 12, 2019
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