mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-08-10 05:05:02 +02:00
[enhancement] Handle initials in author normalization
This commit is contained in:
parent
b2acdadcea
commit
f3555a12ce
1 changed files with 6 additions and 1 deletions
|
@ -64,7 +64,12 @@ class BookFinder {
|
||||||
|
|
||||||
cleanAuthorForCompares(author) {
|
cleanAuthorForCompares(author) {
|
||||||
if (!author) return ''
|
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) {
|
filterSearchResults(books, title, author, maxTitleDistance, maxAuthorDistance) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue