Skip to content

Commit

Permalink
feat(place): support for places such as "Air & Space Museum" (#31)
Browse files Browse the repository at this point in the history
  • Loading branch information
missinglink authored May 28, 2019
1 parent 490e47d commit 3272908
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 2 deletions.
19 changes: 19 additions & 0 deletions classifier/scheme/place.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,24 @@ module.exports = [
not: []
}
]
},
{
// Air & Space Museum
confidence: 0.8,
Class: PlaceClassification,
scheme: [
{
is: ['AlphaClassification'],
not: ['StreetClassification', 'IntersectionClassification', 'StopWordClassification']
},
{
is: ['StopWordClassification'],
not: ['StreetClassification']
},
{
is: ['PlaceClassification'],
not: []
}
]
}
]
4 changes: 2 additions & 2 deletions parser/AddressParser.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ class AddressParser extends Parser {
new CompositeClassifier(require('../classifier/scheme/person')),
new CompositeClassifier(require('../classifier/scheme/street_name')),
new CompositeClassifier(require('../classifier/scheme/street')),
new CompositeClassifier(require('../classifier/scheme/intersection')),
new CompositeClassifier(require('../classifier/scheme/place'))
new CompositeClassifier(require('../classifier/scheme/place')),
new CompositeClassifier(require('../classifier/scheme/intersection'))
],
// solvers
[
Expand Down
19 changes: 19 additions & 0 deletions test/venue.usa.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
const AddressParser = require('../parser/AddressParser')

const testcase = (test, common) => {
let parser = new AddressParser()
let assert = common.assert.bind(null, test, parser)

assert('Air & Space Museum Washington DC', [
{ place: 'Air & Space Museum' },
{ locality: 'Washington' }, { region: 'DC' }
], true)
}

module.exports.all = (tape, common) => {
function test (name, testFunction) {
return tape(`USA: ${name}`, testFunction)
}

testcase(test, common)
}

0 comments on commit 3272908

Please sign in to comment.