Skip to content

Commit

Permalink
feat(relax_token_distance_filter): simple fix for #29 (#30)
Browse files Browse the repository at this point in the history
  • Loading branch information
missinglink authored May 27, 2019
1 parent 8c2d180 commit 490e47d
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
2 changes: 1 addition & 1 deletion solver/TokenDistanceFilter.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// enforce a maximum span distance between classifications
// eg. {housenumber} should not be more than n chars from {street}

const MAX_DISTANCE = 1
const MAX_DISTANCE = 2

class TokenDistanceFilter {
solve (tokenizer) {
Expand Down
20 changes: 20 additions & 0 deletions test/address.ind.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
const AddressParser = require('../parser/AddressParser')

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

assert('100, Mahalakshmi Rd, Ganesh Nagar, Kirti Nagar, New Sanghavi, Pimpri-Chinchwad, Maharashtra 411027', [
{ housenumber: '100' }, { street: 'Mahalakshmi Rd' },
{ locality: 'Pimpri-Chinchwad' }, { region: 'Maharashtra' },
{ postcode: '411027' }
], true)
}

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

testcase(test, common)
}

0 comments on commit 490e47d

Please sign in to comment.