mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2024-12-20 19:06:06 +01:00
Remove "et al[.]" in author cleanup
This commit is contained in:
parent
80458e24bd
commit
8ac0ce399f
@ -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
|
||||
}
|
||||
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user