def dist_abs(self, src, tar, gap_cost=<NUM_LIT:1>, sim_func=sim_ident):
d_mat = np_zeros((len(src) + <NUM_LIT:1>, len(tar) + <NUM_LIT:1>), dtype=np_float32)<EOL>for i in range(len(src) + <NUM_LIT:1>):<EOL><INDENT>d_mat[i, <NUM_LIT:0>] = -(i * gap_cost)<EOL><DEDENT>for j in range(len(tar) + <NUM_LIT:1>):<EOL><INDENT>d_mat[<NUM_LIT:0>, j] = -(j * gap_cost)<EOL><DEDENT>for i in range(<NUM_LIT:1>, len(src) + <NUM_LIT:1>):<EOL><INDENT>for j in range(<NUM_LIT:1>, len(tar) + <NUM_LIT:1>):<EOL><INDENT>match = d_mat[i - <NUM_LIT:1>, j - <NUM_LIT:1>] + sim_func(src[i - <NUM_LIT:1>], tar[j - <NUM_LIT:1>])<EOL>delete = d_mat[i - <NUM_LIT:1>, j] - gap_cost<EOL>insert = d_mat[i, j - <NUM_LIT:1>] - gap_cost<EOL>d_mat[i, j] = max(match, delete, insert)<EOL><DEDENT><DEDENT>return d_mat[d_mat.shape[<NUM_LIT:0>] - <NUM_LIT:1>, d_mat.shape[<NUM_LIT:1>] - <NUM_LIT:1>]<EOL>
Return the Needleman-Wunsch score of two strings.

        Parameters
        ----------
        src : str
            Source string for comparison
        tar : str
            Target string for comparison
        gap_cost : float
            The cost of an alignment gap (1 by default)
        sim_func : function
            A function that returns the similarity of two characters (identity
            similarity by default)

        Returns
        -------
        float
            Needleman-Wunsch score

        Examples
        --------
        >>> cmp = NeedlemanWunsch()
        >>> cmp.dist_abs('cat', 'hat')
        2.0
        >>> cmp.dist_abs('Niall', 'Neil')
        1.0
        >>> cmp.dist_abs('aluminum', 'Catalan')
        -1.0
        >>> cmp.dist_abs('ATCG', 'TAGC')
        0.0