Address Normalization
Addresses
Lookup to validate addresses
Suggestion of addresses on input
Sanitization service
Normalization service
If we have lat/long we can use to validate address?
Stack
libpostal: NLP address expand and parse
sonic: Sonic is to Elasticsearch what Redis is to Postgres
pelias: Open source geocodoer using elastic
Example
const postal = require('node-postal');
const parser = require('parse-address');
const address = [{
"name": "SF30 - 340 Bryant Street 2nd FL",
"expected": "SF30-2FL",
"description": "340 Bryant Street, San Francisco, CA, 94107, USA"
},
{
"name": "SF29 - 222 Kearny St 7th&9th FL",
"expected": 'SF29-7FL-9FL',
"description": "222 Kearny Street, San Francisco, CA, 94108"
},
{
"name": "SF25 - Movable Ink 5th FL",
"expected": 'SF25-5FL',
"description": "800 Market Street, SF"
},
{
"name": "SF25 - Base Building Elevators",
"expected": 'SF25-BASE_BUILDING',
"description": "800 Market Street, SF"
},
{
"name": "SF25 - Credit Karma 4th FL",
"expected": 'SF25-4FL',
"description": "800 Market Street, SF"
},
{
"name": "SF29 - 222 Kearny Elevators",
"expected": 'SF29-ELEVATOR',
"description": "222 Kearny Street, San Francisco, CA, 94108"
},
{
"name": "SF29 - 222 Kearny Front Door",
"expected": 'SF29-FRONT-DOOR',
"description": "222 Kearny Street, San Francisco, CA, 94108"
},
{
"name": "LA31-1547 9th St Santa Monica",
"expected": 'LA31',
"description": "1547 9th St Santa Monica, CA 90401"
},
{
"name": "SF26 - 731 Sansome Street",
"expected": 'SF26',
"description": "731 Sansome Street, San Francisco, CA"
},
{
"name": "SF26 - Base Building System",
"expected": 'SF26-BASE_BUILDING',
"description": "731 Sansome Street,San Francisco, CA"
},
{
"name": "SF30 - 340 Bryant",
"expected": 'SF30',
"description": "340 Bryant, SF"
},
{
"name": "SF33 - 180 Sansome Street 2nd FL",
"expected": 'SF33-2FL',
"description": "180 Sansome Street, SF, CA 94104"
},
{
"name": "SF33 - 180 Sansome Street 3rd FL",
"expected": 'SF33-3FL',
"description": "180 Sansome Street, SF, CA 94104"
},
{
"name": "SF30 - 340 Bryant Street 3rd FL",
"expected": 'SF30-3FL',
"description": "340 Bryant Street, San Francisco, CA, 94107, USA"
},
//TODO: How do we deal with typos like this one?
{
"name": "SF33 - 180 Sansome Street",
"expected": 'SF33',
"description": "180 SansomeStreet, SF, CA 94104"
},
]
address.map(a => {
console.log('---------------------- %s', a.description);
console.log(parser.parseLocation(a.description));
console.log('---')
console.log(postal.expand.expand_address(a.description));
console.log(postal.parser.parse_address(a.description));
});
// parser.parseLocation('1005 N Gravenstein Highway Sebastopol CA 95472');
Other libraries include simple text normalization: