Initial tests for False Positives
This commit is contained in:
parent
3722ab2af3
commit
f00516ce2e
5 changed files with 94342 additions and 1 deletions
|
|
@ -30,6 +30,10 @@ const partNames = new Map([
|
|||
[NICKNAME, 'nickname']
|
||||
])
|
||||
|
||||
const filteredWords = [
|
||||
'al'
|
||||
]
|
||||
|
||||
// group-id to type-id
|
||||
|
||||
function processMasterNamePartGroup (groupNode) {
|
||||
|
|
@ -68,7 +72,17 @@ const processAlias = _.curry((groupTypes, aliasNode) => {
|
|||
const parts = _.map(getNamePart, namePartNodes)
|
||||
|
||||
const fullName = nameUtils.makeFullName(parts)
|
||||
const words = nameUtils.makeWords(fullName)
|
||||
const words = _.flow(
|
||||
nameUtils.makeWords,
|
||||
_.reject(_.flow(
|
||||
_.get('value'),
|
||||
word => filteredWords.includes(word)
|
||||
))
|
||||
)(fullName)
|
||||
|
||||
// if (words.length < 2) {
|
||||
// console.log(JSON.stringify(words))
|
||||
// }
|
||||
|
||||
return {id, parts, fullName, words}
|
||||
})
|
||||
|
|
|
|||
88799
tests/ofac/dist.all.last.txt
Normal file
88799
tests/ofac/dist.all.last.txt
Normal file
File diff suppressed because it is too large
Load diff
4275
tests/ofac/dist.female.first.txt
Normal file
4275
tests/ofac/dist.female.first.txt
Normal file
File diff suppressed because it is too large
Load diff
1219
tests/ofac/dist.male.first.txt
Normal file
1219
tests/ofac/dist.male.first.txt
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -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