TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Show HN: Parse Address – Simple Address Parsing API

10 pointsby traviswingoalmost 8 years ago

3 comments

traviswingoalmost 8 years ago
Hey all. I built this as a simple to use solution for parsing free-form street addresses around the world. It&#x27;s currently integrated into my other side project, postcardbot.co. I&#x27;ve had many people reach out to me about the address accuracy, so I&#x27;ve decided to separate it out into it&#x27;s own project.<p>I&#x27;ll keep it free for now, unless people start abusing it.
brad0almost 8 years ago
I&#x27;m curious as to why you chose an array of components as a response instead of an object of component keys?
评论 #14782709 未加载
Jemaclusalmost 8 years ago
This does a pretty good job for a simple, naive parser.<p>Some possible edge cases to consider:<p><i>123 Summit Blvd West Palm Beach FL 33406</i> This returns the city as &quot;West Palm Beach&quot;, when it is actually in &quot;Palm Beach&quot; and the street would be &quot;Summit Blvd W&quot;. (How do you know? lots of ways, but ZIP is the obvious contender)<p><i>W324S7840 Paul Ln, Mukwonago, WI 53149</i> In some places in Wisconsin, they have something called the WISCRS (&quot;whiskers&quot;), which is a coordinate-based address system. The &quot;W324S7840&quot; is actually the &quot;number&quot; component, while &quot;Paul Ln&quot; is the street name.<p><i>Carmel, CA</i> There is actually a portion of Carmel that doesn&#x27;t have any mailboxes. Kind of a strange place. Probably not relevant to this, but worth mentioning.<p>Like I said, this is pretty good for naive parsing. It&#x27;s not <i>terribly</i> useful for businesses, though, because for most business cases, you need more than simple breaking down into components.<p>For example:<p>- &quot;SF&quot; and &quot;San Francisco&quot; are equivalent but not == to each other, so if someone were using this to de-duplicate addresses, they would hit a failure point here.<p>- &quot;Street&quot; and &quot;St&quot; are equivalent but not == to each other, so not de-duplicatable.<p>- Minor misspellings, like &quot;Warrington&quot; vs &quot;Warington&quot;. You can&#x27;t detect these, necessarily, without a more comprehensive database, but misspellings would contribute to billing&#x2F;shipping errors and duplication issues.<p>- ZIP codes can tell you a lot about an address. For example, all ZIPs beginning with &quot;941&quot; are in San Francisco, &quot;946&quot; are in Oakland, &quot;945&quot; are in Alameda, and so on. Getting a list of all the states and city ZIP codes can help you determine whether to keep or reject an address&#x27;s ZIP code. For example, I put in &quot;123 Main St, Boston, MA 90210&quot;, and it just spat out &quot;90210&quot;. If you remember the 90s at all, you&#x27;ll know that 90210 in California, not in Massachusetts. This would cause a failure in either billing or shipping for any business. The ZIP Code is actually super powerful. For example, in 94102, there are only 44 possible streets. If you were to create this ZIP-city-street mapping, you could very quickly verify the authenticity of the street, city, state, and ZIP components. (Numbers are harder, units even harder than that.)<p>- 401 Rodeo Way, Austin, TX is an apartment complex, but 403 Rodeo Way, Austin, TX is a parking lot (and is not a real address). For most business cases, you don&#x27;t want to allow people to put in bad addresses. This is hard, though, because sometimes databases don&#x27;t get updated with new construction or renovated buildings. Tricky, but something to consider.<p>To be clear, I think you&#x27;ve done a fantastic job. I built a full-featured address parser for a large real estate company a few years ago. In fact, this is my go-to coding challenge when I interview engineers. I say &quot;Here&#x27;s 123 Main St, Boston, MA 00235. Break it apart into its components.&quot; Typically, they try and split on commas or use a regex, in which case I would remove the commas and everything breaks. There are a ton of ways to write an address, all of which may be valid, but are hard to predict. Another good example would be something like &quot;123 St Francis Ave, Boston, MA 00235&quot;. The &quot;St&quot; in &quot;St Francis&quot; trips people up often, but your app catches that. Fantastic job with that.<p>Keep up the good work. Super impressed. It&#x27;d be great if you could tackle some of the edge cases I mentioned above, especially with regards to correcting ZIP codes.