Skip to content

Commit

Permalink
test(central_european_streets): add additional tests
Browse files Browse the repository at this point in the history
  • Loading branch information
missinglink committed Apr 24, 2020
1 parent c6db8fa commit ae0aa7b
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
6 changes: 6 additions & 0 deletions classifier/CentralEuropeanStreetNameClassifier.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@ class CentralEuropeanStreetNameClassifier extends SectionClassifier {
// other elements cannot contain any public classifications
if (_.some(first.classifications, (c) => c.public)) { return }

// optionally check parent phrases too?
// if (_.some(first.graph.findAll('parent'), (p) => {
// if (p.norm !== first.norm) { return false }
// return _.some(p.classifications, (c) => c.public)
// })) { return }

// assume the first token is a street name
first.classify(new StreetClassification(0.5))
}
Expand Down
5 changes: 5 additions & 0 deletions test/address.deu.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ const testcase = (test, common) => {
{ locality: 'Munich' }, { country: 'Germany' }
])

assert('Esplanade 17, Berlin', [
{ street: 'Esplanade' }, { housenumber: '17' },
{ locality: 'Berlin' }
])

assert('Königsallee Düsseldorf', [
{ street: 'Königsallee' },
{ locality: 'Düsseldorf' }
Expand Down
4 changes: 4 additions & 0 deletions test/address.fra.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,10 @@ const testcase = (test, common) => {
assert(`10 Boulevard Saint-Germains Paris`, [
{ housenumber: '10' }, { street: `Boulevard Saint-Germains` }, { locality: 'Paris' }
])

assert(`Paris 75000, France`, [
{ locality: 'Paris' }, { postcode: '75000' }, { country: 'France' }
])
}

module.exports.all = (tape, common) => {
Expand Down

0 comments on commit ae0aa7b

Please sign in to comment.