def cprob(self, c, history):
        """
        :param history: string
        :param c: character
        P[c | history] = (f(history+c) + 1)/(f(history) + |V|-1)
        Implement add-1 smoothing with backoff for simplicty.
        TODO: Does it make sense
        returns P[c | history]
        """
        if not history:
            return 1
        hist = history[:]
        if len(history) >= self._n:
            history = history[-(self._n-1):]
        if not isinstance(history, str):
            history = str(history)
        d, n = 0.0, 0.0
        while (d == 0.0) and len(history) >= 1:
            try:
                d = self.get_freq(history)
                n = self.get_freq(history + c)
            except UnicodeDecodeError as e:
                print(("ERROR:", repr(history), e))
                raise e
            history = history[1:]

        assert d != 0, "ERROR: Denominator zero!\n" \
                       "d={} n={} history={!r} c={!r} ({})" \
            .format(d, n, hist, c, self._n)

        return (n + 1) / (d + N_VALID_CHARS-1)