From a65218d347b682da291ee16b6f84ddf4aba4827a Mon Sep 17 00:00:00 2001 From: David Blackman Date: Sat, 8 Aug 2020 17:35:02 -0400 Subject: [PATCH] fix(venue_classification): follow/preceed filters after place->venue rename (#115) --- parser/AddressParser.js | 18 +++++++++--------- test/address.usa.test.js | 11 +++++++++++ 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/parser/AddressParser.js b/parser/AddressParser.js index 4f44f8d4..522905c0 100644 --- a/parser/AddressParser.js +++ b/parser/AddressParser.js @@ -101,15 +101,15 @@ class AddressParser extends Parser { ['HouseNumberClassification', 'PostcodeClassification', 'LocalityClassification'], ['HouseNumberClassification', 'PostcodeClassification', 'RegionClassification'], ['HouseNumberClassification', 'PostcodeClassification', 'CountryClassification'], - ['PlaceClassification', 'HouseNumberClassification'], - ['PlaceClassification', 'PostcodeClassification'] + ['VenueClassification', 'HouseNumberClassification'], + ['VenueClassification', 'PostcodeClassification'] ]), - new MustNotFollowFilter('PlaceClassification', 'HouseNumberClassification'), - new MustNotFollowFilter('PlaceClassification', 'StreetClassification'), - new MustNotFollowFilter('PlaceClassification', 'LocalityClassification'), - new MustNotFollowFilter('PlaceClassification', 'RegionClassification'), - new MustNotFollowFilter('PlaceClassification', 'CountryClassification'), - new MustNotFollowFilter('PlaceClassification', 'PostcodeClassification'), + new MustNotFollowFilter('VenueClassification', 'HouseNumberClassification'), + new MustNotFollowFilter('VenueClassification', 'StreetClassification'), + new MustNotFollowFilter('VenueClassification', 'LocalityClassification'), + new MustNotFollowFilter('VenueClassification', 'RegionClassification'), + new MustNotFollowFilter('VenueClassification', 'CountryClassification'), + new MustNotFollowFilter('VenueClassification', 'PostcodeClassification'), new MustNotPreceedFilter('PostcodeClassification', 'HouseNumberClassification'), new MustNotPreceedFilter('PostcodeClassification', 'StreetClassification'), new MustNotPreceedFilter('LocalityClassification', 'HouseNumberClassification'), @@ -121,7 +121,7 @@ class AddressParser extends Parser { new MustNotPreceedFilter('CountryClassification', 'PostcodeClassification'), new MustNotPreceedFilter('CountryClassification', 'StreetClassification'), new MustNotPreceedFilter('CountryClassification', 'HouseNumberClassification'), - new MustNotPreceedFilter('PlaceClassification', 'UnitClassification'), + new MustNotPreceedFilter('VenueClassification', 'UnitClassification'), new MustNotFollowFilter('LocalityClassification', 'RegionClassification'), new MustNotFollowFilter('LocalityClassification', 'CountryClassification'), new HouseNumberPositionPenalty(), diff --git a/test/address.usa.test.js b/test/address.usa.test.js index 9844b3ac..2e11e2c9 100644 --- a/test/address.usa.test.js +++ b/test/address.usa.test.js @@ -195,6 +195,17 @@ const testcase = (test, common) => { assert('E William Cannon Dr', [ { street: 'E William Cannon Dr' } ]) + + // There was a bug where multiple interpretations were being + // returned for this query because "Deerfield Beach" was interpreted + // as a possible venue. This test checks for that regression. + assert('3551 W. Hillsboro Blvd Deerfield Beach, FL 33442', [[ + { housenumber: '3551' }, + { street: 'W. Hillsboro Blvd' }, + { locality: 'Deerfield Beach' }, + { region: 'FL' }, + { postcode: '33442' } + ]], false) } module.exports.all = (tape, common) => {