From c40ab06dd6b1eddca9429fc0f1cdcc9ec5f80b8b Mon Sep 17 00:00:00 2001 From: Al Date: Tue, 15 Dec 2015 00:56:34 -0500 Subject: [PATCH] [python] Forgot expand.py --- python/postal/expand.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 python/postal/expand.py diff --git a/python/postal/expand.py b/python/postal/expand.py new file mode 100644 index 00000000..5586a65a --- /dev/null +++ b/python/postal/expand.py @@ -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)