Any mailing address parser on Yii?

User may input the following string for location for a search, like (www.yelp.com) e.g.:

453 adams St, Dorchester, MA 02122

or

Wellesley, MA

or

02457

or

MA

Is there an extension to parse the string into “city”, “state”, and “zip” ? I checked out the Yii extension and couldn’t find any related things. But I think it’s a common task, somebody must have done it before.

Thank you!

Full text search on those three fields?

I never saw a extension for this.

Try phpclasses, google and then create a component for this based on your finds and add to the repository =)

I don’t know what is Full text search. But just search against database related field, e.g.: business.state = ‘MA’, and business.zip = ‘02493’, etc.

Gosh… It’s challenging for me, but I will definitely share it with you guys if I come across some result.

You’d need to parse the input using regex, Parse city, state and zip, compare the result using CDbCriteria::compare() perhaps with $partialMatch set to ‘true’.


{


   "name": "1600 Amphitheatre Parkway, Mountain View, CA, USA",


   "Status": {


 	"code": 200,


     "request": "geocode"


   },


   "Placemark": [


 	{


       "address": "1600 Amphitheatre Pkwy, Mountain View, CA 94043, USA",


       "AddressDetails": {


         "Country": {


           "CountryNameCode": "US",


    	   "AdministrativeArea": {


             "AdministrativeAreaName": "CA",


             "SubAdministrativeArea": {


               "SubAdministrativeAreaName": "Santa Clara",


               "Locality": {


                 "LocalityName": "Mountain View",


        	     "Thoroughfare": {


                   "ThoroughfareName": "1600 Amphitheatre Pkwy"


             	},


                 "PostalCode": {


                   "PostalCodeNumber": "94043"


             	}


           	}


         	}


       	}


     	},


         "Accuracy": 8


   	},


       "Point": {


         "coordinates": [-122.083739, 37.423021, 0]


   	}


 	}


   ]


 }


 



Thanks a lot, Putera! Do you know what kind language is the above code? I am not familiar with this, let along the logic…

It is JSON