def dist_abs(self, src, tar, mode='<STR_LIT>', cost=(<NUM_LIT:1>, <NUM_LIT:1>, <NUM_LIT:1>, <NUM_LIT:1>)):
ins_cost, del_cost, sub_cost, trans_cost = cost<EOL>if src == tar:<EOL><INDENT>return <NUM_LIT:0><EOL><DEDENT>if not src:<EOL><INDENT>return len(tar) * ins_cost<EOL><DEDENT>if not tar:<EOL><INDENT>return len(src) * del_cost<EOL><DEDENT>d_mat = np_zeros((len(src) + <NUM_LIT:1>, len(tar) + <NUM_LIT:1>), dtype=np_int)<EOL>for i in range(len(src) + <NUM_LIT:1>):<EOL><INDENT>d_mat[i, <NUM_LIT:0>] = i * del_cost<EOL><DEDENT>for j in range(len(tar) + <NUM_LIT:1>):<EOL><INDENT>d_mat[<NUM_LIT:0>, j] = j * ins_cost<EOL><DEDENT>for i in range(len(src)):<EOL><INDENT>for j in range(len(tar)):<EOL><INDENT>d_mat[i + <NUM_LIT:1>, j + <NUM_LIT:1>] = min(<EOL>d_mat[i + <NUM_LIT:1>, j] + ins_cost,  <EOL>d_mat[i, j + <NUM_LIT:1>] + del_cost,  <EOL>d_mat[i, j]<EOL>+ (sub_cost if src[i] != tar[j] else <NUM_LIT:0>),  <EOL>)<EOL>if mode == '<STR_LIT>':<EOL><INDENT>if (<EOL>i + <NUM_LIT:1> > <NUM_LIT:1><EOL>and j + <NUM_LIT:1> > <NUM_LIT:1><EOL>and src[i] == tar[j - <NUM_LIT:1>]<EOL>and src[i - <NUM_LIT:1>] == tar[j]<EOL>):<EOL><INDENT>d_mat[i + <NUM_LIT:1>, j + <NUM_LIT:1>] = min(<EOL>d_mat[i + <NUM_LIT:1>, j + <NUM_LIT:1>],<EOL>d_mat[i - <NUM_LIT:1>, j - <NUM_LIT:1>] + trans_cost,<EOL>)<EOL><DEDENT><DEDENT><DEDENT><DEDENT>return d_mat[len(src), len(tar)]<EOL>
Return the Levenshtein distance between two strings.

        Parameters
        ----------
        src : str
            Source string for comparison
        tar : str
            Target string for comparison
        mode : str
            Specifies a mode for computing the Levenshtein distance:

                - ``lev`` (default) computes the ordinary Levenshtein distance,
                  in which edits may include inserts, deletes, and
                  substitutions
                - ``osa`` computes the Optimal String Alignment distance, in
                  which edits may include inserts, deletes, substitutions, and
                  transpositions but substrings may only be edited once

        cost : tuple
            A 4-tuple representing the cost of the four possible edits:
            inserts, deletes, substitutions, and transpositions, respectively
            (by default: (1, 1, 1, 1))

        Returns
        -------
        int (may return a float if cost has float values)
            The Levenshtein distance between src & tar

        Examples
        --------
        >>> cmp = Levenshtein()
        >>> cmp.dist_abs('cat', 'hat')
        1
        >>> cmp.dist_abs('Niall', 'Neil')
        3
        >>> cmp.dist_abs('aluminum', 'Catalan')
        7
        >>> cmp.dist_abs('ATCG', 'TAGC')
        3

        >>> cmp.dist_abs('ATCG', 'TAGC', mode='osa')
        2
        >>> cmp.dist_abs('ACTG', 'TAGC', mode='osa')
        4