def dist(self, src, tar, probs=None):
if src == tar:<EOL><INDENT>return <NUM_LIT:0.0><EOL><DEDENT>if probs is None:<EOL><INDENT>self._coder.train(src + tar)<EOL><DEDENT>else:<EOL><INDENT>self._coder.set_probs(probs)<EOL><DEDENT>src_comp = self._coder.encode(src)[<NUM_LIT:1>]<EOL>tar_comp = self._coder.encode(tar)[<NUM_LIT:1>]<EOL>concat_comp = self._coder.encode(src + tar)[<NUM_LIT:1>]<EOL>concat_comp2 = self._coder.encode(tar + src)[<NUM_LIT:1>]<EOL>return (<EOL>min(concat_comp, concat_comp2) - min(src_comp, tar_comp)<EOL>) / max(src_comp, tar_comp)<EOL>
Return the NCD between two strings using arithmetic coding.

        Parameters
        ----------
        src : str
            Source string for comparison
        tar : str
            Target string for comparison
        probs : dict
            A dictionary trained with :py:meth:`Arithmetic.train`

        Returns
        -------
        float
            Compression distance

        Examples
        --------
        >>> cmp = NCDarith()
        >>> cmp.dist('cat', 'hat')
        0.5454545454545454
        >>> cmp.dist('Niall', 'Neil')
        0.6875
        >>> cmp.dist('aluminum', 'Catalan')
        0.8275862068965517
        >>> cmp.dist('ATCG', 'TAGC')
        0.6923076923076923