hassansin / parse-address

US Street Address Parser
http://hassansin.github.io/parse-address/
Other
158 stars 81 forks source link

Implement Geo::StreetAddress::US's normalizer #17

Closed jgimbel closed 6 years ago

jgimbel commented 6 years ago

Geo::StreetAddress::US creates a list of keys to check and normalize. In the normalize_address function it goes through those keys and normalizes the values. This port is currently missing that normalization. This PR adds that normalizer.

Because the normalizer changes the output of the function, I had to update the test.js file to reflect the changes. To ensure the new test cases matched what the PERL library would output, I created the values by calling the perl library directly for all the addresses. After I did this I noticed plus4 was missing from the perl library. I manually altered the data that PERL created to add plus4.

With the new tests, the punctuation parser was failing because it converted "S.E." to "SE.". The output from the PERL library was "SE". This seems to be because the punctuation regex was different between this port and the PERL library. I updated the regex so they are both the same, and this test case was resolved.

Lastly, PERL does not support the street type 'Row'. The test case for Row was manually updated to work for this library, and not be what the PERL library outputs.

hassansin commented 6 years ago

Awesome. Thanks for the PR. Can you please also increment the major version?

jgimbel commented 6 years ago

major version has been updated