Fix duplicate detector ignoring similarity settings for remixes

Normalization was stripping parenthetical content before comparison,
so 'title' and 'title (xxx remix)' both became 'title' and always
matched at 1.0 regardless of the user's threshold setting.
This commit is contained in:
Broque Thomas 2026-03-18 12:47:34 -07:00
parent 2564e6bf4f
commit 8abcf386d5

View file

@ -207,9 +207,11 @@ class DuplicateDetectorJob(RepairJob):
def _normalize(text: str) -> str:
"""Normalize text for fuzzy comparison."""
"""Normalize text for fuzzy comparison.
Keeps parenthetical content (remixes, live, etc.) so that similarity
thresholds can distinguish 'title' from 'title xxx remix'.
"""
t = text.lower()
t = re.sub(r'\(.*?\)', '', t)
t = re.sub(r'\[.*?\]', '', t)
t = re.sub(r'[^a-z0-9 ]', '', t)
t = re.sub(r'[^a-z0-9() ]', '', t)
return t.strip()