Match aliases with only one word
This commit is contained in:
parent
9d609e6461
commit
051dac127b
2 changed files with 9 additions and 1 deletions
|
|
@ -66,12 +66,16 @@ function match (structs, candidate, threshold) {
|
|||
)(wordValues)
|
||||
|
||||
// At least two name-parts must match per alias
|
||||
const adequateMatch = ([aliasId, count]) => {
|
||||
const alias = structs.aliasesMap.get(aliasId)
|
||||
return count >= Math.min(2, alias.words.length)
|
||||
}
|
||||
const aliasIdsFromNamePart = _.flow(
|
||||
_.uniqWith(_.isEqual),
|
||||
_.map(_.get('aliasId')),
|
||||
_.countBy(_.identity),
|
||||
_.toPairs,
|
||||
_.filter(_.flow(_.last, _.lte(2))),
|
||||
_.filter(adequateMatch),
|
||||
_.map(_.first)
|
||||
)([...phoneticMatches, ...stringMatches])
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue