From e15036fccea84a4e08d00bfe1764dd8588685cdc Mon Sep 17 00:00:00 2001 From: Al Date: Sat, 19 Nov 2016 04:11:33 -0500 Subject: [PATCH] [fix] if there are street types that are not venue words and not vice versa, then call the venue invalid as a standalone term --- scripts/geodata/address_expansions/gazetteers.py | 10 +++++----- scripts/geodata/osm/formatter.py | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/scripts/geodata/address_expansions/gazetteers.py b/scripts/geodata/address_expansions/gazetteers.py index c296750f..db352947 100644 --- a/scripts/geodata/address_expansions/gazetteers.py +++ b/scripts/geodata/address_expansions/gazetteers.py @@ -156,16 +156,16 @@ class DictionaryPhraseFilter(PhraseFilter): STREET_TYPES_ONLY_DICTIONARIES = ('street_types', + 'directionals', 'concatenated_suffixes_separable', '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', - 'people', - 'personal_suffixes', - 'personal_titles', 'qualifiers', 'stopwords', ) diff --git a/scripts/geodata/osm/formatter.py b/scripts/geodata/osm/formatter.py index 97677ebd..11587b76 100644 --- a/scripts/geodata/osm/formatter.py +++ b/scripts/geodata/osm/formatter.py @@ -215,7 +215,7 @@ class OSMAddressFormatter(object): venue_phrases = venue_names_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 if not address_components and not venue_phrases: