[python] Forgot expand.py

This commit is contained in:
Al
2015-12-15 00:56:34 -05:00
parent 842ef4526b
commit c40ab06dd6

16
python/postal/expand.py Normal file
View File

@@ -0,0 +1,16 @@
import _expand
from postal.text.encoding import safe_decode
DEFAULT_LANGUAGES = ('en',)
def expand_address(address, languages=DEFAULT_LANGUAGES, **kw):
'''
@param address: the address as either Unicode or a UTF-8 encoded string
@param languages: a tuple or list of ISO language code strings (e.g. "en", "fr", "de", etc.)
to use in expansion. Default is English. Until automatic language classification
is ready in libpostal, this parameter is required.
'''
address = safe_decode(address, 'utf-8')
return _expand.expand_address(address, languages=languages, **kw)