本文整理汇总了Python中collatex.Collation.add_plain_witness方法的典型用法代码示例。如果您正苦于以下问题:Python Collation.add_plain_witness方法的具体用法?Python Collation.add_plain_witness怎么用?Python Collation.add_plain_witness使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类collatex.Collation
的用法示例。
在下文中一共展示了Collation.add_plain_witness方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_lcp_child_intervals_hermans_case
# 需要导入模块: from collatex import Collation [as 别名]
# 或者: from collatex.Collation import add_plain_witness [as 别名]
def test_lcp_child_intervals_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")
collation.add_plain_witness("W3", "a b c d E g h i ! q r s t")
_, child_lcp_intervals = collation.get_lcp_intervals()
self.assertFalse(child_lcp_intervals)
示例2: test_non_overlapping_blocks_overlap_case
# 需要导入模块: from collatex import Collation [as 别名]
# 或者: from collatex.Collation import add_plain_witness [as 别名]
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
示例3: test_filter_potential_blocks
# 需要导入模块: from collatex import Collation [as 别名]
# 或者: from collatex.Collation import add_plain_witness [as 别名]
def test_filter_potential_blocks(self):
collation = Collation()
collation.add_plain_witness("W1", "the fox jumps over the fox")
collation.add_plain_witness("w2", "the fox jumps over the dog")
potential_blocks = collation.calculate_potential_blocks()
collation.filter_potential_blocks(potential_blocks)
self.fail("TESTING!")
示例4: testDoubleTransposition1
# 需要导入模块: from collatex import Collation [as 别名]
# 或者: from collatex.Collation import add_plain_witness [as 别名]
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_hermans_witness_order_independence_case_two_witnesses
# 需要导入模块: from collatex import Collation [as 别名]
# 或者: from collatex.Collation import add_plain_witness [as 别名]
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())
示例6: testBeckett
# 需要导入模块: from collatex import Collation [as 别名]
# 或者: from collatex.Collation import add_plain_witness [as 别名]
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())
示例7: test_non_overlapping_blocks_black_cat
# 需要导入模块: from collatex import Collation [as 别名]
# 或者: from collatex.Collation import add_plain_witness [as 别名]
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)
示例8: test_non_overlapping_blocks_Hermans
# 需要导入模块: from collatex import Collation [as 别名]
# 或者: from collatex.Collation import add_plain_witness [as 别名]
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
示例9: test_exact_matching
# 需要导入模块: from collatex import Collation [as 别名]
# 或者: from collatex.Collation import add_plain_witness [as 别名]
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())
示例10: test_witness_ranges_hermans_case
# 需要导入模块: from collatex import Collation [as 别名]
# 或者: from collatex.Collation import add_plain_witness [as 别名]
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"))
示例11: test_token_array_hermans_case
# 需要导入模块: from collatex import Collation [as 别名]
# 或者: from collatex.Collation import add_plain_witness [as 别名]
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)
示例12: test_blocks_splitting_token_case
# 需要导入模块: from collatex import Collation [as 别名]
# 或者: from collatex.Collation import add_plain_witness [as 别名]
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)
示例13: test_non_overlapping_blocks_Hermans
# 需要导入模块: from collatex import Collation [as 别名]
# 或者: from collatex.Collation import add_plain_witness [as 别名]
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
示例14: test_superbase_generation_multiple_short_witnesses
# 需要导入模块: from collatex import Collation [as 别名]
# 或者: from collatex.Collation import add_plain_witness [as 别名]
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)
示例15: test_near_matching
# 需要导入模块: from collatex import Collation [as 别名]
# 或者: from collatex.Collation import add_plain_witness [as 别名]
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())