def testKeepScore(self):
    """Toy example where Input='1 2', Output='2', References=['1 2', 1']."""
    # Unigram counts.
    source_counts = collections.Counter({1: 1, 2: 1})
    prediction_counts = collections.Counter({2: 1})
    target_counts = collections.Counter({1: 1, 2: 0.5})
    score = sari_hook.get_keep_score(source_counts, prediction_counts,
                                     target_counts)
    self.assertAlmostEqual(6.0/15, score)
Toy example where Input='1 2', Output='2', References=['1 2', 1'].
tensor2tensor/utils/sari_hook_test.py