[openaddresses] Adding optional hyphen between unit number

This commit is contained in:
Al
2016-08-26 23:46:19 -04:00
parent 8c6a4c763c
commit d29e4f3b2e

View File

@@ -43,7 +43,7 @@ class OpenAddressesFormatter(object):
for (lang, dictionary_type), values in six.iteritems(address_phrase_dictionaries.phrases):
if dictionary_type == 'unit_types_numbered':
unit_phrases = itertools.chain(*[safe_encode(p) for p in values if len(p) > 2])
pattern = re.compile(r'\b(?:{})\s+(?:#?\s*)(?:[\d]+|[a-z]|[a-z][\d]+|[\d]+[a-z])\s*$'.format(six.u('|').join(unit_phrases)),
pattern = re.compile(r'\b(?:{})\s+(?:#?\s*)(?:[\d]+|[a-z]|[a-z]\-?[\d]+|[\d]+\-?[a-z])\s*$'.format(six.u('|').join(unit_phrases)),
re.I | re.UNICODE)
unit_type_regexes[lang] = pattern