Remove "et al[.]" in author cleanup

This commit is contained in:
mikiher 2023-11-30 21:17:13 +02:00
parent 80458e24bd
commit 8ac0ce399f
2 changed files with 3 additions and 0 deletions

View File

@ -462,6 +462,8 @@ function cleanAuthorForCompares(author) {
cleanAuthor = cleanAuthor.replace(/([a-z])\.([a-z])/g, '$1. $2')
// remove middle initials
cleanAuthor = cleanAuthor.replace(/(?<=\w\w)(\s+[a-z]\.?)+(?=\s+\w\w)/g, '')
// remove et al.
cleanAuthor = cleanAuthor.replace(/et al\.?/g, '')
return cleanAuthor
}

View File

@ -111,6 +111,7 @@ describe('AuthorCandidates', () => {
['adds recognized author if edit distance from candidate is small', 'nicolai gogol', ['nikolai gogol']],
['does not add candidate if edit distance from any recognized author is large', 'nikolai google', []],
['adds normalized recognized candidate (contains redundant spaces)', 'nikolai gogol', ['nikolai gogol']],
['adds normalized recognized candidate (et al removed)', 'nikolai gogol et al.', ['nikolai gogol']],
['adds normalized recognized candidate (normalized initials)', 'j.k. rowling', ['j. k. rowling']],
].forEach(([name, author, expected]) => it(name, async () => {
authorCandidates.add(author)