本文整理汇总了Python中collatex.Collation类的典型用法代码示例。如果您正苦于以下问题:Python Collation类的具体用法?Python Collation怎么用?Python Collation使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Collation类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_hermans_witness_order_independence_case_two_witnesses
def test_hermans_witness_order_independence_case_two_witnesses(self):
collation = Collation()
collation.add_plain_witness("A", "a b c d F g h i ! K ! q r s t")
collation.add_plain_witness("B", "a b c d F g h i ! q r s t")
alignment_table = collate(collation)
self.assertEquals(["a b c d F g h i!", "K!", "q r s t"], alignment_table.rows[0].to_list())
self.assertEquals(["a b c d F g h i!", "-", "q r s t"], alignment_table.rows[1].to_list())
示例2: testBeckett
def testBeckett(self):
collation = Collation()
collation.add_plain_witness("1", "The same clock as when for example Magee once died.")
collation.add_plain_witness("2", "The same as when for example Magee once died.")
table = collate(collation)
self.assertEquals(["The same", "clock", "as when for example Magee once died."], table.rows[0].to_list())
self.assertEquals(["The same", None, "as when for example Magee once died."], table.rows[1].to_list())
示例3: test_non_overlapping_blocks_overlap_case
def test_non_overlapping_blocks_overlap_case(self):
collation = Collation()
collation.add_plain_witness("W1", "in the in the bleach")
collation.add_plain_witness("W2", "in the in the bleach in the")
algorithm = Scorer(collation)
blocks = algorithm._get_non_overlapping_repeating_blocks()
self.assertIn(Block(RangeSet("0-4, 7-11")), blocks) # in the in the bleach
示例4: testDoubleTransposition1
def testDoubleTransposition1(self):
collation = Collation()
collation.add_plain_witness("A", "the cat is black")
collation.add_plain_witness("B", "black is the cat")
alignment_table = collate(collation)
self.assertEquals(["the cat", "is", "black"], alignment_table.rows[0].to_list())
self.assertEquals(["black", "is", "the cat"], alignment_table.rows[1].to_list())
示例5: test_non_overlapping_blocks_Hermans
def test_non_overlapping_blocks_Hermans(self):
collation = Collation()
collation.add_plain_witness("W1", "a b c d F g h i ! K ! q r s t")
collation.add_plain_witness("W2", "a b c d F g h i ! q r s t")
algorithm = Scorer(collation)
blocks = algorithm._get_non_overlapping_repeating_blocks()
self.assertIn(Block(RangeSet("0-8, 17-25")), blocks) # a b c d F g h i !
self.assertIn(Block(RangeSet("11-14, 26-29")), blocks) # q r s t
示例6: test_non_overlapping_blocks_black_cat
def test_non_overlapping_blocks_black_cat(self):
collation = Collation()
collation.add_plain_witness("W1", "the black cat")
collation.add_plain_witness("W2", "the black cat")
algorithm = Scorer(collation)
blocks = algorithm._get_non_overlapping_repeating_blocks()
block1 = Block(RangeSet("0-2, 4-6"))
self.assertEqual([block1], blocks)
示例7: test_witness_ranges_hermans_case
def test_witness_ranges_hermans_case(self):
collation = Collation()
collation.add_plain_witness("W1", "a b c d F g h i ! K ! q r s t")
collation.add_plain_witness("W2", "a b c d F g h i ! q r s t")
token_index = TokenIndex(collation.witnesses)
token_index.prepare()
self.assertEqual(RangeSet("0-14"), token_index.get_range_for_witness("W1"))
self.assertEqual(RangeSet("16-28"), token_index.get_range_for_witness("W2"))
示例8: test_near_matching
def test_near_matching(self):
collation = Collation()
collation.add_plain_witness("A", "I bought this glass, because it matches those dinner plates")
collation.add_plain_witness("B", "I bought those glasses")
alignment_table = collate(collation, near_match=True)
self.assertEquals(["I bought", "this glass, because it matches those dinner plates"],
alignment_table.rows[0].to_list())
self.assertEquals(["I bought", "those glasses"], alignment_table.rows[1].to_list())
示例9: test_blocks_splitting_token_case
def test_blocks_splitting_token_case(self):
collation = Collation()
collation.add_plain_witness("W1", "a c b c")
collation.add_plain_witness("W2", "a c b")
algorithm = Scorer(collation)
blocks = algorithm._get_non_overlapping_repeating_blocks()
block1 = Block(RangeSet("0-2, 5-7")) # a c b
self.assertIn(block1, blocks)
示例10: test_token_array_hermans_case
def test_token_array_hermans_case(self):
collation = Collation()
collation.add_plain_witness("W1", "a b c d F g h i ! K ! q r s t")
collation.add_plain_witness("W2", "a b c d F g h i ! q r s t")
token_index = TokenIndex(collation.witnesses)
token_index.prepare()
# $ is meant to separate witnesses here
self.assertTokenArray("a b c d F g h i ! K ! q r s t $0 a b c d F g h i ! q r s t", token_index)
示例11: test_non_overlapping_blocks_Hermans
def test_non_overlapping_blocks_Hermans(self):
collation = Collation()
collation.add_plain_witness("W1", "a b c d F g h i ! K ! q r s t")
collation.add_plain_witness("W2", "a b c d F g h i ! q r s t")
algorithm = Scorer(TokenIndex.create_token_index(collation))
blocks = algorithm._get_non_overlapping_repeating_blocks()
self.assertIn(Block(RangeSet("0-8, 16-24")), blocks) # a b c d F g h i !
self.assertIn(Block(RangeSet("11-14, 25-28")), blocks) # q r s t
示例12: test_exact_matching
def test_exact_matching(self):
collation = Collation()
collation.add_plain_witness("A", "I bought this glass , because it matches those dinner plates")
collation.add_plain_witness("B", "I bought those glasses")
alignment_table = collate(collation)
self.assertEqual(["I bought ", "this glass , because it matches ", "those ", "dinner plates"],
alignment_table.rows[0].to_list_of_strings())
self.assertEqual(["I bought ", None, "those ", "glasses"], alignment_table.rows[1].to_list_of_strings())
示例13: test_superbase_generation_multiple_short_witnesses
def test_superbase_generation_multiple_short_witnesses(self):
collation = Collation()
collation.add_plain_witness("A", "a")
collation.add_plain_witness("B", "b")
collation.add_plain_witness("C", "c")
aligner = EditGraphAligner(collation)
graph = VariantGraph()
aligner.collate(graph)
示例14: test_non_overlapping_blocks_Hermans
def test_non_overlapping_blocks_Hermans(self):
collation = Collation()
collation.add_plain_witness("W1", "a b c d F g h i ! K ! q r s t")
collation.add_plain_witness("W2", "a b c d F g h i ! q r s t")
alignment_table = collate(collation)
print("alignment_table=\n", alignment_table)
self.assertEqual(['a b c d F g h i ', '! K ', '! q r s t'], alignment_table.rows[0].to_list_of_strings())
self.assertEqual(['a b c d F g h i ', None, '! q r s t'], alignment_table.rows[1].to_list_of_strings())
示例15: test_hermans_witness_order_independence_case_three_witnesses
def test_hermans_witness_order_independence_case_three_witnesses(self):
collation = Collation()
collation.add_plain_witness("A", "a b c d F g h i ! K ! q r s t")
collation.add_plain_witness("B", "a b c d F g h i ! q r s t")
collation.add_plain_witness("C", "a b c d E g h i ! q r s t")
alignment_table = collate(collation)
self.assertEquals(["a b c d ", "F ", "g h i ", "! K ", "! q r s t"], alignment_table.rows[0].to_list_of_strings())
self.assertEquals(["a b c d ", "F ", "g h i ", None, "! q r s t"], alignment_table.rows[1].to_list_of_strings())
self.assertEquals(["a b c d ", "E ", "g h i ", None, "! q r s t"], alignment_table.rows[2].to_list_of_strings())