[fix] if there are street types that are not venue words and not vice versa, then call the venue invalid as a standalone term

This commit is contained in:
Al
2016-11-19 04:11:33 -05:00
parent 8e905fd17d
commit e15036fcce
2 changed files with 6 additions and 6 deletions

View File

@@ -156,16 +156,16 @@ class DictionaryPhraseFilter(PhraseFilter):
STREET_TYPES_ONLY_DICTIONARIES = ('street_types', STREET_TYPES_ONLY_DICTIONARIES = ('street_types',
'directionals',
'concatenated_suffixes_separable', 'concatenated_suffixes_separable',
'concatenated_suffixes_inseparable', 'concatenated_suffixes_inseparable',
'concatenated_prefixes_separable', 'people',
'personal_suffixes',
'personal_titles',
) )
STREET_TYPES_DICTIONARIES = STREET_TYPES_ONLY_DICTIONARIES + ('directionals', STREET_TYPES_DICTIONARIES = STREET_TYPES_ONLY_DICTIONARIES + ('concatenated_prefixes_separable',
'organizations', 'organizations',
'people',
'personal_suffixes',
'personal_titles',
'qualifiers', 'qualifiers',
'stopwords', 'stopwords',
) )

View File

@@ -215,7 +215,7 @@ class OSMAddressFormatter(object):
venue_phrases = venue_names_gazetteer.extract_phrases(name, languages=languages) venue_phrases = venue_names_gazetteer.extract_phrases(name, languages=languages)
street_phrases = street_types_only_gazetteer.extract_phrases(name, languages=languages) street_phrases = street_types_only_gazetteer.extract_phrases(name, languages=languages)
if street_phrases - venue_phrases and not (AddressFormatter.HOUSE_NUMBER in address_components and AddressFormatter.ROAD in address_components): if street_phrases - venue_phrases and not venue_phrases - street_phrases and not (AddressFormatter.HOUSE_NUMBER in address_components and AddressFormatter.ROAD in address_components):
return False return False
if not address_components and not venue_phrases: if not address_components and not venue_phrases: