I have checked the docs of difflib and i'm confused on how difflib.SequenceMatcher.ratio()
actually works. Consider this :
s = difflib.SequenceMatcher(None, "hey here" , "hey there").ratio()
print s
gives s = 0.9411764705882353
I wanted to know how exactly it is computed . The 2 strings are compared by actually looking at the deviation of one string w.r.t other.for 2 strings a and b The docs say :
differences are computed as "what do we need to do to 'a' to change it into 'b'?"
And there is something like :
for x in b, b2j[x] is a list of the indices (into b) at which x appears; junk elements do not appear
Please explain w.r.t the above example of s .