def _evaluate(self, prediction):
        def calc_prop_distance(ref, pred):
            if len(ref) == 0:
                return 1.0
            diff = len(set(ref) - set(pred))
            return (len(ref) - diff) / float(len(ref))

        wordlist = sorted(set(prediction.keys()) & set(self.reference.keys()))

        recall_sum = 0.0
        precis_sum = 0.0

        for word in wordlist:
            if len(word) < 2:
                continue

            recall_sum += max(calc_prop_distance(r, p)
                              for p, r in product(prediction[word],
                                                  self.reference[word]))

            precis_sum += max(calc_prop_distance(p, r)
                              for p, r in product(prediction[word],
                                                  self.reference[word]))

        precision = precis_sum / len(wordlist)
        recall = recall_sum / len(wordlist)
        f_score = 2.0 / (1.0 / precision + 1.0 / recall)

        return precision, recall, f_score, len(wordlist)
Test the xy slice cutout with incorrect cutout arguments
dataset/ETHPy150Open aalto-speech/morfessor/morfessor/evaluation.py/MorfessorEvaluation._evaluate--crossover with--dataset/ETHPy150Open neurodata/ndstore/test/test_probability.py/Test_Probability_Slice.test_xy_incorrect