ishiland / nyc-parser

Parse single line NYC addresses

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

NYC Parser

A utility to parse NYC addresses and BBLs from a single line input.

Python 2.7 | 3.4+ Build Status PyPI version

Install

$ pip install nyc-parser

or clone this repo, cd into it and

$ pip install .

Usage

>> from nycparser import Parser

>> p = Parser()

# Parse an address
>> p.address('74-12 35th ave, Queens NY 11372')

{'PHN': '74-12',
'STREET': '35TH AVE',
'BOROUGH_CODE': 4,
'BOROUGH_NAME': 'QUEENS',
'ZIP': '11372'}


# Parse a BBL with or without special characters, just needs 10 digits.
>> p.bbl('1-00438-0006')

{'BLOCK': 438,
'LOT': 6,
'BOROUGH_CODE': 1,
'BOROUGH_NAME': 'MANHATTAN'}


# There is also a dictionary to get Borough code from Borough Name.
>> p.borough_dict['BROOKLYN']

3


# Or you can do the reverse.
>> p.borough_dict_reverse[3]

'BROOKLYN'

Contribute

Issues and PRs welcome.

License

MIT

About

Parse single line NYC addresses


Languages

Language:Python 100.0%