def testDeletionScore(self):
    """Toy example where Input='1 2', Output='1 2', References=['1']."""
    # Unigram counts.
    source_counts = collections.Counter({1: 1, 2: 1})
    prediction_counts = collections.Counter({1: 1, 2: 1})
    target_counts = collections.Counter({1: 1})
    # Output doesn't drop any (incorrect) tokens from the input so precision
    # should be 1, but since '2' is not dropped, recall should be 0. Thus we
    # should have F1=0 and F0=precision=1.
    f1_score = sari_hook.get_deletion_score(source_counts, prediction_counts,
                                            target_counts, beta=1)
    self.assertEqual(0, f1_score)
    f0_score = sari_hook.get_deletion_score(source_counts, prediction_counts,
                                            target_counts, beta=0)
    self.assertEqual(1, f0_score)
Toy example where Input='1 2', Output='1 2', References=['1'].
tensor2tensor/utils/sari_hook_test.py