(s1, s2)
Relative Levenshtein distance taking its upper bound into consideration and return a value in [0, 1]
Relative Levenshtein distance taking its upper bound into consideration and return a value in [0, 1]
Relative Levenshtein distance taking its upper bound into consideration and return a value in [ 0 1 ]
def rel_levenshtein(s1, s2):
    """Relative Levenshtein distance taking its upper bound into consideration and return a value in [0, 1]"""
    maxlen = max(len(s1), len(s2))
    if maxlen > 0:
        return levenshtein(s1, s2) / float(maxlen)
    else:
        return 0
def rel_levenshtein ( s1 , s2 ) : maxlen = max ( len ( s1 ) , len ( s2 ) ) if maxlen > 0 : return levenshtein ( s1 , s2 ) / float ( maxlen ) else : return 0