'Tests that the simple CTC decoder drops nulls and duplicates.'

def testCodesFromCTC(self):

    ctc_labels = [9, 9, 9, 1, 9, 2, 2, 3, 9, 9, 0, 0, 1, 9, 1, 9, 9, 9]
    decode = decoder.Decoder(filename=None)
    non_null_labels = decode._CodesFromCTC(ctc_labels, merge_dups=False, null_label=9)
    self.assertEqual(non_null_labels, [1, 2, 2, 3, 0, 0, 1, 1])
    idempotent_labels = decode._CodesFromCTC(non_null_labels, merge_dups=False, null_label=9)
    self.assertEqual(idempotent_labels, non_null_labels)
    collapsed_labels = decode._CodesFromCTC(ctc_labels, merge_dups=True, null_label=9)
    self.assertEqual(collapsed_labels, [1, 2, 3, 0, 1, 1])
    non_idempotent_labels = decode._CodesFromCTC(collapsed_labels, merge_dups=True, null_label=9)
    self.assertEqual(non_idempotent_labels, [1, 2, 3, 0, 1])
