def exact_comparator(title): """Create a SequenceMatcher instance with compare_with method for more exact matching.""" sm = SequenceMatcher(a=title) def compare_with(other): sm.set_seq2(other) return sm.ratio() sm.compare_with = compare_with return sm
def loose_comparator(title): """Create a SequenceMatcher instance with compare_with method for loose matching.""" sm = SequenceMatcher(a=clean_title(title)) def compare_with(other): sm.set_seq2(clean_title(other)) return sm.ratio() sm.compare_with = compare_with return sm