Replaced isEqual for better performance
This commit is contained in:
parent
051dac127b
commit
f8ec2be6e8
2 changed files with 4 additions and 5 deletions
|
|
@ -66,10 +66,10 @@ function match (nameParts, birthDateString, threshold) {
|
|||
const birthDate = {year, month, day, date}
|
||||
|
||||
const candidate = {parts, fullName, wordValues, wordPhonetics, birthDate}
|
||||
debug_log(candidate)
|
||||
// debug_log(candidate)
|
||||
|
||||
const result = matcher.match(structs, candidate, threshold)
|
||||
debug_log(result)
|
||||
// debug_log(result)
|
||||
return result
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -39,7 +39,6 @@ function match (structs, candidate, threshold) {
|
|||
const aliases = _.flatMap(_.get('aliases'), structs.individuals)
|
||||
const aliasIdsFromFullName = _.flow(
|
||||
_.filter(doesNameMatch),
|
||||
|
||||
_.map(_.get('id'))
|
||||
)(aliases)
|
||||
|
||||
|
|
@ -53,7 +52,7 @@ function match (structs, candidate, threshold) {
|
|||
|
||||
// Gether aliases whose name-parts match alphabetically.
|
||||
const getStringMatches = value => {
|
||||
const entryMatches = entry => (jaroWinkler(value, entry.value) >= threshold)
|
||||
const entryMatches = entry => (stringSimilarity(value, entry.value) >= threshold)
|
||||
return _.filter(entryMatches, structs.wordList)
|
||||
}
|
||||
const getSingleEntries = wordEntry => {
|
||||
|
|
@ -71,7 +70,7 @@ function match (structs, candidate, threshold) {
|
|||
return count >= Math.min(2, alias.words.length)
|
||||
}
|
||||
const aliasIdsFromNamePart = _.flow(
|
||||
_.uniqWith(_.isEqual),
|
||||
_.uniqWith((a, b) => a.value === b.value && a.aliasId === b.aliasId),
|
||||
_.map(_.get('aliasId')),
|
||||
_.countBy(_.identity),
|
||||
_.toPairs,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue