-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGeoLiberator_Demo.py
56 lines (51 loc) · 1.54 KB
/
GeoLiberator_Demo.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# -*- coding: utf-8 -*-
'''
Author: David J. Morfe
Application Name: GeoLiberator Demo
Functionality Purpose: Demonstrate the address parsing module 'GeoLiberator'
Version: Beta
'''
#Single Address Test
#Upload file for multiple addresses
#Display liberated output
from GeoLiberator import *
import time
import sys
class Unbuffered(object):
def __init__(self, stream):
self.stream = stream
def write(self, data):
self.stream.write(data)
self.stream.flush()
def writelines(self, datas):
self.stream.writelines(datas)
self.stream.flush()
def __getattr__(self, attr):
return getattr(self.stream, attr)
sys.stdout = Unbuffered(sys.stdout)
a = "Welcome to the GeoLiberator Application\n"
for i in a:
print(i, end='')
time.sleep(.02)
b = """This application demonstrates this Python module's ability
to intake messy addresses and output uniform addresses\n"""
for i in b:
print(i, end='')
time.sleep(.02)
print("Type 'quit' to exit...\n")
while True:
address = input("Enter any address: ")
if address.lower() == "exit" or address.lower() == "quit":
exit()
print("street - Street Name\n1 - House Number\n2 - Full Address")
m = int(input("Enter a number 0-2: "))
if address == '':
address = "123 Main St, (Default Test Address)"
print("Before: ", address, "\nAfter: ", end='')
if m == 2:
m = "address"
elif m == 1:
m = "number"
elif m == 0:
m = "street"
geoLiberate(address, m)