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:
parent
2564e6bf4f
commit
8abcf386d5
1 changed files with 6 additions and 4 deletions
|
|
@ -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()
|
||||
|
|
|
|||
Loading…
Reference in a new issue