Skip to content

Commit

Permalink
feat(transit): support for parsing transit stop ids, additional dicti…
Browse files Browse the repository at this point in the history
…onary updates (#38)
  • Loading branch information
missinglink authored Jun 5, 2019
1 parent 94c9b4a commit 4eae07c
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 2 deletions.
15 changes: 15 additions & 0 deletions classifier/scheme/place.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,5 +64,20 @@ module.exports = [
not: []
}
]
},
{
// Stop 10792
confidence: 0.8,
Class: PlaceClassification,
scheme: [
{
is: ['PlaceClassification'],
not: ['StreetClassification', 'IntersectionClassification', 'StopWordClassification']
},
{
is: ['NumericClassification'],
not: []
}
]
}
]
4 changes: 3 additions & 1 deletion parser/AddressParser.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,9 @@ class AddressParser extends Parser {
['HouseNumberClassification', 'PostcodeClassification'],
['HouseNumberClassification', 'PostcodeClassification', 'LocalityClassification'],
['HouseNumberClassification', 'PostcodeClassification', 'RegionClassification'],
['HouseNumberClassification', 'PostcodeClassification', 'CountryClassification']
['HouseNumberClassification', 'PostcodeClassification', 'CountryClassification'],
['PlaceClassification', 'HouseNumberClassification'],
['PlaceClassification', 'PostcodeClassification']
]),
new MustNotFollowFilter('PlaceClassification', 'HouseNumberClassification'),
new MustNotFollowFilter('PlaceClassification', 'StreetClassification'),
Expand Down
5 changes: 4 additions & 1 deletion resources/pelias/dictionaries/libpostal/en/place_names.txt
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
temple
temple
cathedral
stop
!dist
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ sf
!university
!hospital
!temple
!cathedral
!airport
!deli
!us
Expand Down
22 changes: 22 additions & 0 deletions test/transit.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
const AddressParser = require('../parser/AddressParser')

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

assert('Stop 1', [
{ place: 'Stop 1' }
], true)

assert('Stop 10010', [
{ place: 'Stop 10010' }
], true)
}

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

testcase(test, common)
}

0 comments on commit 4eae07c

Please sign in to comment.