I'm looking for a Java function that canonicalizes an address. For example, ideally it would give me the same output for all of the following:

  • "73 e main street apt 10, boston, ma 02129"
  • "73 East Main St #10, Boston, Massachusetts 02129-4340"
  • "73 E Main apartment 10, Boston MA"

It's not necessary to verify if the address corresponds to a real place. I just want a canonical address formatter.

I believe that https://postgis.net/docs/Address_Standardizer.html is an example of what I'm looking for, but it's difficult to make calls to that from Java.

  • I hope that by "Maryland" you mean "Massachusetts". Still, I think that most software for canonicalizing addresses won't be able to handle your example because it won't be able to infer the ZIP code or state when these are missing. These are matters for a GIS rather than a mere address parser. – Kodiologist Jun 20 '17 at 18:15
  • Thanks for the catch. I think I would be happy with a text parser doing what it can -- perhaps the zip code is not a critical part of the address. I've added a state to my last example since I agree that that is critical. – Dan B Jun 20 '17 at 21:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.