Fix name sorting by splitting on symbols instead of removing them
Change IntelligentKnownName tokenizer to replace punctuation with spaces instead of removing them. This creates token boundaries at symbol positions, fixing sorting of names like "15-9" vs "15-10" which were previously being compared as single numbers (159 vs 1510). Fixes issue where hyphenated numbers like 15-10 appeared after 20-4 instead of after 15-9. Co-authored-by: OxygenCobalt <65370175+OxygenCobalt@users.noreply.github.com>
This commit is contained in:
co-authored by
OxygenCobalt
parent
893024c239
commit
0c2e1a3fbd
@@ -86,10 +86,10 @@ private data class IntelligentKnownName(override val raw: String, override val s
|
||||
// optimize it
|
||||
val stripped =
|
||||
name
|
||||
// Remove excess punctuation from the string, as those usually aren't
|
||||
// considered in sorting.
|
||||
.replace(punctRegex, "")
|
||||
.ifEmpty { name }
|
||||
// Replace punctuation with spaces to create token boundaries, improving
|
||||
// sorting of names like "15-9" vs "15-10".
|
||||
.replace(punctRegex, " ")
|
||||
.let { if (it.isBlank()) name else it }
|
||||
.run {
|
||||
// Strip any english articles like "the" or "an" from the start, as music
|
||||
// sorting should ignore such when possible.
|
||||
|
||||
Reference in New Issue
Block a user