[states] adding all forms of the state abbreviation to the trie when doing place name normalization to handle the D.C./DC case

This commit is contained in:
Al
2016-12-10 13:45:22 -05:00
parent 5098599ed6
commit ffc584f679
2 changed files with 16 additions and 12 deletions

View File

@@ -350,9 +350,9 @@ class AddressComponents(object):
if is_state:
for state in component_names:
for language in languages:
state_code = state_abbreviations.get_abbreviation(country, language, state, default=None)
if state_code:
names.add(state_code.upper())
abbreviations = state_abbreviations.get_all_abbreviations(country, language, state, default=None)
if abbreviations:
names.update([a.upper() for a in abbreviations])
phrase_filter = PhraseFilter([(n.lower(), '') for n in names])