I am trying out the difflib library. I have two lists: L_1 and L_2 containing strings. I want to know, if those sequences are similar (order is not important).
L_1 = ["Bob", "Mary", "Hans"]
L_2 = ["Bob", "Marie", "Háns"]
should be ok. But
L_1 = ["Nirdosch", "Mary", "Rolf"]
L_2 = ["Bob", "Marie", "Háns"]
should not be ok.
I came up with the idea of iterating over the first list L_1 and to match every element of L_1 by the method
difflib.get_close_matches()
against the second list L_2. If there was a match with a ratio bigger then let's say 0.7 remove it from L_2 and continue. But I doubt it is a good plan. Is there a better one?