newbie question: parsing street name from address

Eric venner at gmail.com
Thu Jun 21 14:43:34 EDT 2007


On Jun 21, 9:47 am, cjl <cjl... at gmail.com> wrote:
> P:
>
> I am working on a project that requires geocoding, and have written a
> very simple geocoder that uses the Google service.
>
> I would like to be able to extract the name of the street from the
> addresses in my data, however they vary significantly. Here a some
> examples:
>
> 25 Main St
> 2500 14th St
> 12 Bennet Pkwy
> Pearl St
> Bennet Rd and Main st
> 19th St
>
> As you can see, sometimes I have the house number, and sometimes I do
> not. Sometimes the street name is a number. Sometimes I simply have
> the names of intersecting streets.
>
> I would like to be able to parse the above into the following:
>
> Main St
> 14th St
> Bennet Pkwy
> Pearl St
> Bennet Rd
> Main St
> 19th St
>
> How might I approach this complex parsing problem?
>
> -CJL

You might be able to use consistencies in your data to make this
simpler.  If the examples you have there are representative, it looks
like what you should do is look for a word like 'St' or 'Rd' and then
return that word and the previous word.




More information about the Python-list mailing list