SequenceMatcher ratio return

204 Views Asked by At

For example, a = 'OrangeApple' and b = 'AppleOrange', after running SequenceMatcher(None, a, b).ratio() the returned ratio (similarity score) is 0.54. If a = 'OrangeApple' and b = 'OrangeApple' the returned ratio is, as expected, 1.

I somehow understand why this happens after reading How does Pythons SequenceMatcher work?, but still not sure how to solve this issue to obtain a ratio equal to 1 in both cases. Any ideas?

0

There are 0 best solutions below