def test_deletion_interspersed(self): a = [('f', 'f'), ('o', EPS_LABEL), ('o', 'o')] actual = list(conv_norm.process_alignment(a, EPS_LABEL, interspersed=True)) expected = [('__BEGIN__', EPS_LABEL), ('f', 'f'), (EPS_LABEL, EPS_LABEL), ('o', EPS_LABEL), (EPS_LABEL, EPS_LABEL), ('o', 'o'), (EPS_LABEL, EPS_LABEL)] self.assertEqual(actual, expected)
def test_mixed_insertion_and_deletion_with_keep(self): a = [('f', 'o'), ('o', EPS_LABEL), (EPS_LABEL, 'x'), ('y', 'n')] actual = list(conv_norm.process_alignment(a, EPS_LABEL, keep=True)) expected = [('__BEGIN__', EPS_LABEL), ('f', 'o'), ('o', 'x'), ('y', 'n')] self.assertEqual(actual, expected)
def test_insertion(self): a = [('f', 'f'), (EPS_LABEL, 'o'), ('o', 'o')] actual = list(conv_norm.process_alignment(a, EPS_LABEL)) expected = [('__BEGIN__', EPS_LABEL), ('f', 'fo'), ('o', 'o')] self.assertEqual(actual, expected)
def test_insertion_at_beginning_with_keep(self): a = [(EPS_LABEL, 'f'), ('o', 'o'), ('o', 'o')] actual = list(conv_norm.process_alignment(a, EPS_LABEL, keep=True)) expected = [('__BEGIN__', 'f'), ('o', KEEP_LABEL), ('o', KEEP_LABEL)] self.assertEqual(actual, expected)
def test_multi_insertion_interspersed(self): a = [('a', 'f'), (EPS_LABEL, 'r'), (EPS_LABEL, 'u'), ('b', 'b')] actual = list(conv_norm.process_alignment(a, EPS_LABEL, interspersed=True)) expected = [('__BEGIN__', EPS_LABEL), ('a', 'f'), (EPS_LABEL, 'ru'), ('b', 'b'), (EPS_LABEL, EPS_LABEL)] self.assertEqual(actual, expected)