8

In iOS there's a class named NSDataDetector that, for example, let's you pass a text and it will detect if that text contains things like postal addresses, dates, links...

In my case, I'm interested in finding a similar tool for Android that let will detect an address inside a text. I've playing around with the Geocoder, but it only works if you already know the address; otherwise, it won't serve the purpose.

An example of what I'm looking for might be:

Given: This is just a sample text that contains a nice address: 123 W Main St, Imaginary City, IC, 12345 The tool would return just 123 W Main St, Imaginary City, IC, 12345

Keep in mind that the address might have different formats.

Thanks in advance!

Jorge
  • 285
  • 2
  • 10

1 Answers1

0

SmartyStreets (Disclaimer: I work for them) has an address Extract API (demo here). It's built specifically for this purpose. Not only will it extract your address from a string, but it will also validate your address. You can either call the API directly, or use the built in tool on the account page.

There are probably other companies that offer this same service, I just can't think of any.

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
camiblanch
  • 3,866
  • 2
  • 19
  • 31
  • 1
    Is this tool only valid for US addresses, or is it able to work with different formats too? – Jorge Jun 22 '16 at 18:44
  • 1
    @Jorge currently it only works for US addresses. Addresses in other countries have more variants in how they are constructed and are more difficult to parse. – camiblanch Jun 22 '16 at 19:17