(short_seq, long_seq)
return current[min_len]
levenshtein distance
    :param short_seq: (shape=[T], type=int), the shorter sequence
    :param long_seq: (shape=[T], tpye=int), the longer sequence
    return: (type=float), the levenshtein distance between short_seq and long_seq
levenshtein distance
    :param short_seq: (shape=[T], type=int), the shorter sequence
    :param long_seq: (shape=[T], tpye=int), the longer sequence
    return: (type=float), the levenshtein distance between short_seq and long_seq
levenshtein distance : param short_seq : ( shape = [ T ] type = int ) the shorter sequence : param long_seq : ( shape = [ T ] tpye = int ) the longer sequence return : ( type = float ) the levenshtein distance between short_seq and long_seq
def levenshtein(short_seq, long_seq):
  ''' levenshtein distance
    :param short_seq: (shape=[T], type=int), the shorter sequence
    :param long_seq: (shape=[T], tpye=int), the longer sequence
    return: (type=float), the levenshtein distance between short_seq and long_seq
    '''
  min_len, max_len = len(short_seq), len(long_seq)
  if min_len > max_len:
    short_seq, long_seq = long_seq, short_seq
    min_len, max_len = max_len, min_len

  current = list(range(min_len + 1))
  for index in range(1, max_len + 1):
    previous, current = current, [index] + [0] * min_len
    for index_1 in range(1, min_len + 1):
      add, delete = previous[index_1] + 1, current[index_1 - 1] + 1
      change = previous[index_1 - 1]
      # string index from zero, but editditance from one
      if short_seq[index_1 - 1] != long_seq[index - 1]:
        change += 1
      current[index_1] = min(change, add, delete)
  return current[min_len]
def levenshtein ( short_seq , long_seq ) : min_len , max_len = len ( short_seq ) , len ( long_seq ) if min_len > max_len : short_seq , long_seq = long_seq , short_seq min_len , max_len = max_len , min_len current = list ( range ( min_len + 1 ) ) for index in range ( 1 , max_len + 1 ) : previous , current = current , [ index ] + [ 0 ] * min_len for index_1 in range ( 1 , min_len + 1 ) : add , delete = previous [ index_1 ] + 1 , current [ index_1 - 1 ] + 1 change = previous [ index_1 - 1 ] # string index from zero, but editditance from one if short_seq [ index_1 - 1 ] != long_seq [ index - 1 ] : change += 1 current [ index_1 ] = min ( change , add , delete ) return current [ min_len ]