WIP
This commit is contained in:
@@ -4,37 +4,6 @@ from difflib import SequenceMatcher
|
||||
from typing import List, Optional, Tuple
|
||||
import re
|
||||
|
||||
# Example usage:
|
||||
if __name__ == "__main__":
|
||||
matcher = TrackMatcher(threshold=0.85)
|
||||
|
||||
candidate_tracks = [
|
||||
"The Beatles - Hey Jude",
|
||||
"Led Zeppelin - Stairway to Heaven",
|
||||
"Queen - Bohemian Rhapsody",
|
||||
"Pink Floyd - Comfortably Numb",
|
||||
"The Beatles - Hey Jules", # Intentionally similar to "Hey Jude"
|
||||
]
|
||||
|
||||
# Test cases
|
||||
test_tracks = [
|
||||
"The Beatles - Hey Jude", # Exact match
|
||||
"Beatles - Hey Jude", # Similar match
|
||||
"The Beatles - Hey Jules", # Similar but different
|
||||
"Metallica - Nothing Else Matters", # No match
|
||||
"Queen - bohemian rhapsody", # Different case
|
||||
]
|
||||
|
||||
for test_track in test_tracks:
|
||||
result = matcher.find_best_match(test_track, candidate_tracks)
|
||||
if result:
|
||||
match, score = result
|
||||
print(f"Input: {test_track}")
|
||||
print(f"Best match: {match}")
|
||||
print(f"Similarity score: {score:.3f}\n")
|
||||
else:
|
||||
print(f"No good match found for: {test_track}\n")
|
||||
|
||||
class TrackMatcher:
|
||||
"""Track Matcher"""
|
||||
def __init__(self, threshold: float = 0.85):
|
||||
|
Reference in New Issue
Block a user