예제 #1
0
	county = open(file_path).read().replace(" "," ").replace("Post Office","P.O.").replace("Ste Genevieve","Ste. Genevieve")
	county = county.replace("\n","").replace("\r","")
	for item in space_re.findall(county_name):
		if "Mc" not in county_name:
			county_name = dogcatcher.insert(county_name," ",county_name.find(item)+1)
		if "De Kalb" in county_name:
			county_name = "DeKalb"

	authority_name = authority_name_re.findall(county)[0]

	county = county.replace(authority_name,"")#Removing as much as possible from the data makes it easier to find the address later.

	office_name = office_name.replace(county_name,"").replace("County","").strip()

	website = dogcatcher.website_find(website_re, county)
	phone = dogcatcher.phone_find(phone_re, county)
	fax = dogcatcher.phone_find(fax_re, county)

	for item in html_re.findall(county): #Removing as much as possible from the data makes it easier to find the address later.
		county = county.replace(item,", ").strip(", ")


	#This section finds the address. After finding the address, it identifies a city/state/zip (csz) combination and a PO Box number if that exists.
    #It removes both the CSZ and the PO Address (if it exists) from the full address, leaving behind a street address with some garbage.
    #It then cleans up the street address and pulls the city, state, and zip out of the csz, and assigns them as appropriate to the street address and state.

	print county

	address = address_re.findall(county)[0]
	print address
예제 #2
0
			po_street = po_re.findall(jurisdiction)[0].replace("v: ","")
		except:
			po_street = ""


		if not po_street:
			street = mailing_address.replace("v: ","")
		elif digit_re.findall(mailing_address.replace(po_street,"")):
			street = mailing_address.replace(po_street,"")
		else:
			po_street = mailing_address
		street = street.rstrip(",")


		email = dogcatcher.find_emails(email_re, jurisdiction)
		phone = dogcatcher.phone_find(phone_re, jurisdiction)
		fax = dogcatcher.phone_find(fax_re, jurisdiction)

		try:
			city = city_re.findall(jurisdiction)[0].replace("v: ","")
		except:
			city = ""

		zip_code_all = zip_code_re.findall(jurisdiction)
		if len(zip_code_all) == 2:
			zip_code = zip_code_all[1].replace("v: ","")
		elif len(zip_code_all) == 1:
			zip_code = zip_code_all[0].replace("v: ","")
		else:
			zip_code = ""