Created
June 6, 2020 07:06
-
-
Save rajatscode/daee9840ddb97adaece0fc24766e4203 to your computer and use it in GitHub Desktop.
Jane Street alternative name generator
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# To get this to work: install names (`pip3 install --user -U names`) | |
import names | |
import random | |
# copied from https://pe.usps.com/text/pub28/28apc_002.htm | |
# hardcoded because requests + BeautifulSoup got too ugly and it's faster to | |
# just extract and prettify the words from the page manually | |
STREET_SUFFIXES = { | |
'Alley', 'Annex', 'Arcade', 'Avenue', 'Bayou', 'Beach', 'Bend', 'Bluff', | |
'Bluffs', 'Bottom', 'Boulevard', 'Branch', 'Bridge', 'Brook', 'Brooks', | |
'Burg', 'Burgs', 'Bypass', 'Camp', 'Canyon', 'Cape', 'Causeway', 'Center', | |
'Centers', 'Circle', 'Circles', 'Cliff', 'Cliffs', 'Club', 'Common', | |
'Commons', 'Corner', 'Corners', 'Course', 'Court', 'Courts', 'Cove', | |
'Coves', 'Creek', 'Crescent', 'Crest', 'Crossing', 'Crossroad', | |
'Crossroads', 'Curve', 'Dale', 'Dam', 'Divide', 'Drive', 'Drives', | |
'Estate', 'Estates', 'Expressway', 'Extension', 'Extensions', 'Fall', | |
'Falls', 'Ferry', 'Field', 'Fields', 'Flat', 'Flats', 'Ford', 'Fords', | |
'Forest', 'Forge', 'Forges', 'Fork', 'Forks', 'Fort', 'Freeway', 'Garden', | |
'Gardens', 'Gateway', 'Glen', 'Glens', 'Green', 'Greens', 'Grove', | |
'Groves', 'Groves', 'Harbor', 'Harbors', 'Haven', 'Heights', 'Highway', | |
'Hill', 'Hills', 'Hollow', 'Inlet', 'Island', 'Islands', 'Isle', | |
'Junction', 'Junctions', 'Key', 'Keys', 'Knoll', 'Knolls', 'Lake', 'Lakes', | |
'Land', 'Landing', 'Lane', 'Light', 'Lights', 'Loaf', 'Lock', 'Locks', | |
'Lodge', 'Loop', 'Mall', 'Manor', 'Manors', 'Meadow', 'Meadows', | |
'Mews', 'Mill', 'Mills', 'Mission', 'Motorway', 'Mount', 'Mountain', | |
'Mountains', 'Neck', 'Orchard', 'Oval', 'Overpass', 'Park', 'Parkway', | |
'Parkways', 'Pass', 'Passage', 'Path', 'Pike', 'Pine', 'Pines', 'Place', | |
'Plain', 'Plains', 'Plaza', 'Point', 'Points', 'Port', 'Ports', 'Prairie', | |
'Radial', 'Ramp', 'Ranch', 'Rapid', 'Rapids', 'Rest', 'Ridge', 'Ridges', | |
'River', 'Road', 'Roads', 'Route', 'Row', 'Rue', 'Run', 'Shoal', 'Shoals', | |
'Shore', 'Shores', 'Skyway', 'Spring', 'Springs', 'Spur', 'Spurs', | |
'Square', 'Squares', 'Station', 'Stravenue', 'Stream', 'Street', | |
'Streets', 'Summit', 'Terrace', 'Throughway', 'Trace', 'Track', | |
'Trafficway', 'Trail', 'Trailer', 'Tunnel', 'Turnpike', 'Underpass', | |
'Union', 'Unions', 'Valley', 'Valleys', 'Viaduct', 'View', 'Views', | |
'Village', 'Villages', 'Ville', 'Vista', 'Walk', 'Walks', 'Wall', 'Way' | |
'Ways', 'Well', 'Wells' | |
} | |
def get_name_starting_with_letter(letter='j'): | |
name = None | |
while name is None or name[0].lower() != letter.lower(): | |
name = names.get_first_name() | |
return name | |
def get_street_suffix(): | |
return random.sample(STREET_SUFFIXES, 1)[0] | |
if __name__ == "__main__": | |
print(' '.join((get_name_starting_with_letter('j'), get_street_suffix()))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment