"""Compare strings and return True even on partial match."""
# this is used to display 'versions' of the same track/album
# where we account for other spelling or some additional wording in the title
- word_count = len(base.split(" "))
+ if len(base) <= 3 or len(alt) <= 3:
+ return compare_strings(base, alt, True)
+ word_count = len(base.strip().split(" "))
if word_count == 1 and len(base) < 10:
return compare_strings(base, alt, False)
base_comp = create_safe_string(base)
alt_comp = create_safe_string(alt)
if base_comp in alt_comp:
return True
- return alt_comp in base_comp
+ return base_comp in alt_comp
def compare_strings(str1: str, str2: str, strict: bool = True) -> bool: