Skip to content

Commit

Permalink
fix(scheme): update person schema to allow middle names (#99)
Browse files Browse the repository at this point in the history
  • Loading branch information
missinglink authored May 19, 2020
1 parent dac59f4 commit f454b59
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
19 changes: 19 additions & 0 deletions classifier/scheme/person.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,25 @@ module.exports = [
}
]
},
{
// Raul Leite Magalhães (first name, middle name, family name)
confidence: 0.5,
Class: PersonClassification,
scheme: [
{
is: ['GivenNameClassification'],
not: ['StreetClassification', 'IntersectionClassification']
},
{
is: ['GivenNameClassification', 'SurnameClassification'],
not: ['StreetClassification', 'IntersectionClassification']
},
{
is: ['SurnameClassification'],
not: ['StreetClassification', 'StreetPrefixClassification', 'StopWordClassification']
}
]
},
{
// Unknown surname
confidence: 0.1,
Expand Down
20 changes: 20 additions & 0 deletions test/address.bra.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
const testcase = (test, common) => {
let assert = common.assert(test)

assert('Rua Raul Leite Magalhães, 65, Tapiraí - SP, 18180-000, Brazil', [
{ street: 'Rua Raul Leite Magalhães' },
{ housenumber: '65' },
{ locality: 'Tapiraí' },
{ region: 'SP' },
{ postcode: '18180' },
{ country: 'Brazil' }
])
}

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

testcase(test, common)
}

0 comments on commit f454b59

Please sign in to comment.