mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-01-08 00:08:14 +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')
|
cleanAuthor = cleanAuthor.replace(/([a-z])\.([a-z])/g, '$1. $2')
|
||||||
// remove middle initials
|
// remove middle initials
|
||||||
cleanAuthor = cleanAuthor.replace(/(?<=\w\w)(\s+[a-z]\.?)+(?=\s+\w\w)/g, '')
|
cleanAuthor = cleanAuthor.replace(/(?<=\w\w)(\s+[a-z]\.?)+(?=\s+\w\w)/g, '')
|
||||||
|
// remove et al.
|
||||||
|
cleanAuthor = cleanAuthor.replace(/et al\.?/g, '')
|
||||||
return cleanAuthor
|
return cleanAuthor
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -111,6 +111,7 @@ describe('AuthorCandidates', () => {
|
|||||||
['adds recognized author if edit distance from candidate is small', 'nicolai gogol', ['nikolai gogol']],
|
['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', []],
|
['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 (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']],
|
['adds normalized recognized candidate (normalized initials)', 'j.k. rowling', ['j. k. rowling']],
|
||||||
].forEach(([name, author, expected]) => it(name, async () => {
|
].forEach(([name, author, expected]) => it(name, async () => {
|
||||||
authorCandidates.add(author)
|
authorCandidates.add(author)
|
||||||
|
Loading…
Reference in New Issue
Block a user