mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-01-13 01:18:30 +01:00
[enhancement] Handle initials in author normalization
This commit is contained in:
parent
b2acdadcea
commit
f3555a12ce
@ -64,7 +64,12 @@ class BookFinder {
|
||||
|
||||
cleanAuthorForCompares(author) {
|
||||
if (!author) return ''
|
||||
return this.replaceAccentedChars(author).toLowerCase()
|
||||
let cleanAuthor = this.replaceAccentedChars(author).toLowerCase()
|
||||
// separate initials
|
||||
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, '')
|
||||
return cleanAuthor
|
||||
}
|
||||
|
||||
filterSearchResults(books, title, author, maxTitleDistance, maxAuthorDistance) {
|
||||
|
Loading…
Reference in New Issue
Block a user