diff --git a/classifier/CompoundStreetClassifier.js b/classifier/CompoundStreetClassifier.js index ed15792e..1866a30f 100644 --- a/classifier/CompoundStreetClassifier.js +++ b/classifier/CompoundStreetClassifier.js @@ -10,13 +10,13 @@ class CompoundStreetClassifier extends WordClassifier { // load street suffixes this.suffixes = {} - libpostal.load(this.suffixes, ['de', 'nl', 'sv'], 'concatenated_suffixes_separable.txt', { + libpostal.load(this.suffixes, ['de', 'nl', 'sv', 'nb'], 'concatenated_suffixes_separable.txt', { // remove any suffixes which contain less than 3 characters (excluding a period) // this removes suffixes such as 'r.' which can be ambiguous minlength: 3 }) - libpostal.load(this.suffixes, ['de', 'nl'], 'concatenated_suffixes_inseparable.txt', { + libpostal.load(this.suffixes, ['de', 'nl', 'nb'], 'concatenated_suffixes_inseparable.txt', { // remove any suffixes which contain less than 3 characters (excluding a period) // this removes suffixes such as 'r.' which can be ambiguous minlength: 3 diff --git a/classifier/DirectionalClassifier.js b/classifier/DirectionalClassifier.js index 3e3cfc82..0303d7b5 100644 --- a/classifier/DirectionalClassifier.js +++ b/classifier/DirectionalClassifier.js @@ -9,7 +9,7 @@ const libpostal = require('../resources/libpostal/libpostal') // optionally control which languages are included // note: reducing the languages will have a considerable performance benefit -const languages = ['en', 'es', 'de', 'fr', 'nl'] +const languages = ['en', 'es', 'de', 'fr', 'nl', 'nb'] class DirectionalClassifier extends WordClassifier { setup () { diff --git a/resources/pelias/dictionaries/libpostal/nb/concatenated_suffixes_inseparable.txt b/resources/pelias/dictionaries/libpostal/nb/concatenated_suffixes_inseparable.txt new file mode 100644 index 00000000..274dfc08 --- /dev/null +++ b/resources/pelias/dictionaries/libpostal/nb/concatenated_suffixes_inseparable.txt @@ -0,0 +1,40 @@ +plass|pl.|p. +haugen +skogen|skog +gården|gård +åsen +haugen +skogen|skog +gården|gård +åsen +gård|gården +holm|holmen +haugen|Haugane +krysset +skogen|skog +grend|grenda +flat|flaten +våg|vågen +strand|stranda|stranden +vik|vika +platå +stad +terrasse +hage|hagen +øya +lund|lunden +holm|holmen +berg|berget +landa|lande|landet +dal|dalen +sund +bakke|bakken +høgda|høgde +borg|borgen +gard|garden|garda +mark|marka +voll|vollen +sjø|sjøen +lie +sti|stien +tangen \ No newline at end of file diff --git a/resources/pelias/dictionaries/libpostal/nb/directionals.txt b/resources/pelias/dictionaries/libpostal/nb/directionals.txt new file mode 100644 index 00000000..a26fb19c --- /dev/null +++ b/resources/pelias/dictionaries/libpostal/nb/directionals.txt @@ -0,0 +1,8 @@ +øvre|ovre +øvste|ovste +nedre +midtre +ytre +indre +sør|sor|s +sørre|sorre \ No newline at end of file diff --git a/resources/pelias/dictionaries/libpostal/nb/street_types.txt b/resources/pelias/dictionaries/libpostal/nb/street_types.txt new file mode 100644 index 00000000..c62bc01b --- /dev/null +++ b/resources/pelias/dictionaries/libpostal/nb/street_types.txt @@ -0,0 +1,36 @@ +plass +haugen +skogen|skog +gården|gård +åsen +gård|gården +holm|holmen +haugen|Haugane +krysset +skogen|skog +grend|grenda +flat|flaten +våg|vågen +strand|stranda|stranden +vik|vika +platå +stad +terrasse +hage|hagen|hager +øya +lund|lunden +holm|holmen +berg|berget +landa|lande|landet +dal|dalen +sund +bakke|bakken +høgda|høgde +borg|borgen +gard|garden|garda +mark|marka +voll|vollen +sjø|sjøen +lie +sti|stien +tangen \ No newline at end of file diff --git a/test/address.nor.test.js b/test/address.nor.test.js new file mode 100644 index 00000000..9efe71d2 --- /dev/null +++ b/test/address.nor.test.js @@ -0,0 +1,47 @@ +const testcase = (test, common) => { + let assert = common.assert(test) + + assert('Skredderplassen 20', [ + { street: 'Skredderplassen' }, { housenumber: '20' } + ]) + + assert('Henrik Walters plass 3', [ + { street: 'Henrik Walters plass' }, { housenumber: '3' } + ]) + + assert('Vestre Haugen 74', [ + { street: 'Vestre Haugen' }, { housenumber: '74' } + ]) + + assert('Maria Dehlis vei 15', [ + { street: 'Maria Dehlis vei' }, { housenumber: '15' } + ]) + + assert('Gamle Drammensvei 163', [ + { street: 'Gamle Drammensvei' }, { housenumber: '163' } + ]) + + assert('Grense Jakobselv veien 311', [ + { street: 'Grense Jakobselv veien' }, { housenumber: '311' } + ]) + + assert('Epleskogen 39A', [ + { street: 'Epleskogen' }, { housenumber: '39A' } + ]) + + assert('Øvste Skogen 121', [ + { street: 'Øvste Skogen' }, { housenumber: '121' } + ]) + + assert('Tindvegen nedre 44B', [ + { street: 'Tindvegen nedre' }, { housenumber: '44B' } + ]) +} + +module.exports.all = (tape, common) => { + function test (name, testFunction) { + return tape(`address AUS: ${name}`, testFunction) + } + + testcase(test, common) +}