def probabilistic_score_laplace()

in learn_bpe.py [0:0]


    def probabilistic_score_laplace(self, unit, new_unit_count):
        total_count = self.n_running_symbols
        normalization = total_count - new_unit_count
        first_count = self.produced_count[unit[0]] - new_unit_count
        second_count = self.produced_count[unit[1]] - new_unit_count
        score = new_unit_count * (math.log(new_unit_count + 1) -
                                  math.log(first_count + 1) -
                                  math.log(second_count + 1) +
                                  math.log(normalization + len(self.produced_count) + 1))
        return score