如何处理重复的街道后缀?
我有一个系统,用户需要输入地址。 当然,我试图限制重复项,我开始注意到成为一个大问题,一些用户输入“Road”,其他用户输入“Rd”,因此重复项正在悄悄出现。
我查找了 USPS 街道后缀缩写列表,但我还有一个问题我找不到答案。 我可以将街道地址中的所有单词替换为 USPS 标准缩写吗? 一个例子是“123 Forest Hill Road”。 如果我用缩写替换它,那么它将是“123 Frst Hl Rd”,或者 USPS 所指的“街道后缀”是否意味着他们只希望您走到“123 Forest Hill Rd”?
I have a system where users need to enter addresses. I am trying to limit duplicates of course and something I started noticing was becoming a big problem was some users putting in "Road" and others "Rd", therefore duplicates were creeping in.
I looked up the list of USPS street suffix abbreviations but I still have a question which I can't find an answer to. Can I replace all words in a street address with the USPS standard abbreviation? An example would be "123 Forest Hill Road". If I were to replace it with the abbreviations it would then be "123 Frst Hl Rd" or does the "street suffix" that USPS is referring to mean they only want you to make go as far as "123 Forest Hill Rd"?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
USPS 有一个 API,可以为您获取格式正确的地址。
USPS has an API that can get you properly formatted addresses.
您必须询问 USPS 才能确定,但我想如果您开始用“123 Frst Hl Rd”替换“123 Forest Hill Rd”,您的应用程序和数据将会遇到麻烦。
我已经对地址做了一些工作,让我告诉你,即使是远程正确地完成这些工作也是非常复杂且耗时的。 在大多数情况下,您最好使用现有的软件包。 例如,您会对通过对免费 Google 地图 API 的一些简单调用所实现的效果感到惊讶。
You would have to ask the USPS to be sure, but I imagine that your app and data would be in trouble if you started replacing "123 Forest Hill Rd" with "123 Frst Hl Rd".
I have done some work with addresses and let me tell you it is very complicated and time consuming to do even remotely correctly. In most cases you would be better off making use of existing packages out there. For example, you would be surprised what you can achieve with a few simple calls to the free Google Maps API.
您能否通过扩展所有术语而不是尝试缩写任何术语来避免整个问题?
Can you avoid the whole problem by expanding all of the terms rather than attempting to abbreviate any?
对于重复项,只是想知道您是否最好让用户从地址类型的下拉列表中进行选择。 将其从用户手中夺走。
关于缩写,您问这个是因为 USPS 需要某种特定格式的地址吗? 只是想知道缩写的目的是什么。 如果我错过了目标,我深表歉意。
On the duplicates, just wondering if you'd be better to make the Users choose from a drop-down of Address Types. Take it out of the User's hands.
On the abbreviation, are you asking this because USPS needs the Address in some specific format? Just wondering what purpose there is in the abbreviating. Apologies if I've missed the mark.
您还可以查看 USPS 邮政地址标准,其中解释了各种地址示例的首选和可接受的格式。
http://pe.usps.gov/text/pub28/pub28c2_toc.htm
在本例中,相关部分是 23 Delivery Address Line。
http://pe.usps.gov/text/pub28/pub28c2_012.htm
You could also take a look at the USPS Postal Addressing Standards which has explanation of the preferred and acceptable formats for various address examples.
http://pe.usps.gov/text/pub28/pub28c2_toc.htm
In the example case, the relevant section is 23 Delivery Address Line.
http://pe.usps.gov/text/pub28/pub28c2_012.htm
尝试自己扩展/收缩地址的麻烦在于,缩写通常可能是街道甚至城市名称的一部分。 例如:“100 Avenue A”,其中 Avenue 不应缩写。 或“900 圣路易斯环路”。 在这种情况下,St 并不意味着街道,而是意味着圣人。
在美国,认证地址的一个组成部分称为交货点条形码 (DPBC)。 它是一个唯一的 12 位值,可以用作地址的唯一标识符。 要获得此值,您需要使用地址验证或地址标准化 Web 服务 API,其费用约为 20 美元/月,具体取决于您向其发出的请求量。 使用此功能,您可以轻松防止重复或进行欺诈预防/检测等。
为了充分披露,我是 SmartyStreets 的创始人。 我们提供的正是这样一个名为 LiveAddress 的地址验证 Web 服务 API。 如果您有任何疑问,我们非常欢迎您亲自与我联系。
The trouble with trying to expand/contract addresses yourself is that oftentimes abbreviations can be part of the street or even city name. For example: "100 Avenue A" where Avenue isn't supposed to be abbreviated. Or "900 St Louis Loop". In this case St don't mean street, it means Saint.
Within the USA, there is a component of a certificated address called a delivery point barcode (DPBC). It's a unique 12-digit value that can serve as the unique identifier of an address. To get this value you'll want to use an address verification or address standardization web service API, which can cost about $20/mo depending upon the volume of requests you make to it. Using this you can easily prevent duplicates or do fraud prevention/detection, etc.
In the interest of full disclosure, I'm the founder of SmartyStreets. We offer just such an address verification web service API called LiveAddress. You're more than welcome to contact me personally with any questions you have.