Initial tests for False Positives
This commit is contained in:
parent
3722ab2af3
commit
f00516ce2e
5 changed files with 94342 additions and 1 deletions
|
|
@ -1,5 +1,7 @@
|
|||
const assert = require('assert')
|
||||
const ofac = require('../../lib/ofac')
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
const _ = require('lodash/fp')
|
||||
|
||||
let structs
|
||||
|
|
@ -206,5 +208,37 @@ describe('OFAC', function () {
|
|||
}
|
||||
})
|
||||
|
||||
it('should not match against common names', function () {
|
||||
this.timeout(0)
|
||||
|
||||
const getNamesFromFile = _.flow(
|
||||
name => path.resolve(__dirname, name),
|
||||
file => fs.readFileSync(file, 'utf-8'),
|
||||
_.split('\n'),
|
||||
_.map( _.flow(
|
||||
_.split(' '),
|
||||
_.first
|
||||
))
|
||||
)
|
||||
|
||||
const lastNames = getNamesFromFile('dist.all.last.txt')
|
||||
const firstNamesMale = getNamesFromFile('dist.male.first.txt')
|
||||
const firstNamesFemale = getNamesFromFile('dist.female.first.txt')
|
||||
|
||||
for (const lastName of lastNames.slice(0, 100)) {
|
||||
for (firstName of firstNamesMale.slice(0, 100)) {
|
||||
const matches = ofac.match({firstName, lastName}, null, 0.8)
|
||||
console.log({firstName, lastName})
|
||||
assert.ok(_.isEmpty(matches))
|
||||
}
|
||||
|
||||
for (firstName of firstNamesFemale.slice(0, 100)) {
|
||||
const matches = ofac.match({firstName, lastName}, null, 0.8)
|
||||
console.log({firstName, lastName})
|
||||
assert.ok(_.isEmpty(matches))
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
})
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue