forked from pelias-deprecated/text-analyzer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
16 lines (14 loc) · 774 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
'use strict';
// validate the WOF importer configuration before continuing
const peliasConfig = require( 'pelias-config' ).generate(require('./schema'));
// Changes to incorporate libpostal were made to minimize the impact to pelias-api
// so exports cannot be a function to conditionally return an analyzer instance.
// This can be changed when addressit goes away and libpostal has become the norm.
if ('libpostal' === peliasConfig.api.textAnalyzer) {
console.log('loading libpostal data, this may take a few seconds...');
const postal = require('node-postal');
module.exports = require('./src/libpostalParser').create(postal.parser.parse_address);
}
else if ('addressit' === peliasConfig.api.textAnalyzer) {
module.exports = require('./src/addressItParser');
}