fix normalization issue on comparison with acoustID
This commit is contained in:
parent
08e34c31b5
commit
1071337659
1 changed files with 4 additions and 0 deletions
|
|
@ -38,6 +38,10 @@ def _normalize(text: str) -> str:
|
||||||
s = text.lower().strip()
|
s = text.lower().strip()
|
||||||
# Remove common parenthetical suffixes like (Live), (Remastered), (Radio Edit)
|
# Remove common parenthetical suffixes like (Live), (Remastered), (Radio Edit)
|
||||||
s = re.sub(r'\s*\((?:live|remaster(?:ed)?|deluxe|bonus|radio\s*edit|single\s*version|visualize.*?)\)', '', s, flags=re.IGNORECASE)
|
s = re.sub(r'\s*\((?:live|remaster(?:ed)?|deluxe|bonus|radio\s*edit|single\s*version|visualize.*?)\)', '', s, flags=re.IGNORECASE)
|
||||||
|
# Remove featuring info: "(feat. ...)", "(ft. ...)", "(featuring ...)"
|
||||||
|
s = re.sub(r'\s*\((?:feat\.?|ft\.?|featuring)\s+[^)]*\)', '', s, flags=re.IGNORECASE)
|
||||||
|
# Remove trailing featuring info: "feat. ...", "ft. ...", "featuring ..."
|
||||||
|
s = re.sub(r'\s+(?:feat\.?|ft\.?|featuring)\s+.*$', '', s, flags=re.IGNORECASE)
|
||||||
# Remove non-alphanumeric except spaces
|
# Remove non-alphanumeric except spaces
|
||||||
s = re.sub(r'[^\w\s]', '', s)
|
s = re.sub(r'[^\w\s]', '', s)
|
||||||
# Collapse whitespace
|
# Collapse whitespace
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue