当前位置: 首页>>代码示例>>Python>>正文


Python Segmenter.intersect方法代码示例

本文整理汇总了Python中LTTL.Segmenter.intersect方法的典型用法代码示例。如果您正苦于以下问题:Python Segmenter.intersect方法的具体用法?Python Segmenter.intersect怎么用?Python Segmenter.intersect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在LTTL.Segmenter的用法示例。


在下文中一共展示了Segmenter.intersect方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_intersect_progress

# 需要导入模块: from LTTL import Segmenter [as 别名]
# 或者: from LTTL.Segmenter import intersect [as 别名]
    def test_intersect_progress(self):
        """Does intersect track progress?"""

        def progress_callback():
            """Mock progress callback"""
            self.count += 1

        Segmenter.intersect(
            source=self.letter_seg,
            filtering=self.third_letter_seg,
            progress_callback=progress_callback,
        )
        self.assertEqual(
            self.count,
            len(self.letter_seg),
            msg="intersect doesn't track progress!"
        )
开发者ID:ArcaniteSolutions,项目名称:LTTL,代码行数:19,代码来源:test_segmenter.py

示例2: test_intersect_neg

# 需要导入模块: from LTTL import Segmenter [as 别名]
# 或者: from LTTL.Segmenter import intersect [as 别名]
 def test_intersect_neg(self):
     """Does intersect output complementary segmentation?"""
     _, segmentation = Segmenter.intersect(
         source=self.letter_seg,
         filtering=self.third_letter_seg,
     )
     self.assertEqual(
         ''.join(s.get_content() for s in segmentation),
         'ace',
         msg="intersect doesn't output complementary segmentation!"
     )
开发者ID:ArcaniteSolutions,项目名称:LTTL,代码行数:13,代码来源:test_segmenter.py

示例3: test_intersect_content_content

# 需要导入模块: from LTTL import Segmenter [as 别名]
# 或者: from LTTL.Segmenter import intersect [as 别名]
 def test_intersect_content_content(self):
     """Does intersect filter segments (content content)?"""
     segmentation, _ = Segmenter.intersect(
         source=self.letter_seg,
         filtering=self.third_letter_seg,
     )
     self.assertEqual(
         ''.join(s.get_content() for s in segmentation),
         'bd',
         msg="intersect doesn't filter segments (content content)!"
     )
开发者ID:ArcaniteSolutions,项目名称:LTTL,代码行数:13,代码来源:test_segmenter.py

示例4: test_intersect_import_annotations_false

# 需要导入模块: from LTTL import Segmenter [as 别名]
# 或者: from LTTL.Segmenter import intersect [as 别名]
 def test_intersect_import_annotations_false(self):
     """Does intersect skip importing annotations?"""
     segmentation, _ = Segmenter.intersect(
         source=self.letter_seg,
         filtering=self.third_letter_seg,
         source_annotation_key='a',
         copy_annotations=False,
     )
     self.assertFalse(
         'a' in segmentation[0].annotations,
         msg="intersect doesn't skip importing annotations!"
     )
开发者ID:ArcaniteSolutions,项目名称:LTTL,代码行数:14,代码来源:test_segmenter.py

示例5: test_intersect_mode

# 需要导入模块: from LTTL import Segmenter [as 别名]
# 或者: from LTTL.Segmenter import intersect [as 别名]
 def test_intersect_mode(self):
     """Does intersect respect mode setting?"""
     segmentation, _ = Segmenter.intersect(
         source=self.letter_seg,
         filtering=self.third_letter_seg,
         mode="exclude",
     )
     self.assertEqual(
         ''.join(s.get_content() for s in segmentation),
         'ace',
         msg="intersect doesn't respect mode setting!"
     )
开发者ID:ArcaniteSolutions,项目名称:LTTL,代码行数:14,代码来源:test_segmenter.py

示例6: test_intersect_autonumber

# 需要导入模块: from LTTL import Segmenter [as 别名]
# 或者: from LTTL.Segmenter import intersect [as 别名]
 def test_intersect_autonumber(self):
     """Does intersect autonumber input segments?"""
     segmentation, _ = Segmenter.intersect(
         source=self.letter_seg,
         filtering=self.third_letter_seg,
         auto_number_as='num'
     )
     self.assertEqual(
         [s.annotations['num'] for s in segmentation],
         [1, 2],
         msg="intersect doesn't autonumber input segments!"
     )
开发者ID:ArcaniteSolutions,项目名称:LTTL,代码行数:14,代码来源:test_segmenter.py

示例7: test_intersect_import_annotations

# 需要导入模块: from LTTL import Segmenter [as 别名]
# 或者: from LTTL.Segmenter import intersect [as 别名]
 def test_intersect_import_annotations(self):
     """Does intersect import annotations?"""
     segmentation, _ = Segmenter.intersect(
         source=self.letter_seg,
         filtering=self.third_letter_seg,
         source_annotation_key='a',
         copy_annotations=True,
     )
     self.assertEqual(
         segmentation[0].annotations['a'],
         '1',
         msg="intersect doesn't import annotations!"
     )
开发者ID:ArcaniteSolutions,项目名称:LTTL,代码行数:15,代码来源:test_segmenter.py

示例8: test_intersect_annotation_annotation

# 需要导入模块: from LTTL import Segmenter [as 别名]
# 或者: from LTTL.Segmenter import intersect [as 别名]
 def test_intersect_annotation_annotation(self):
     """Does intersect filter segments (annotation annotation)?"""
     segmentation, _ = Segmenter.intersect(
         source=self.letter_seg,
         filtering=self.third_letter_seg,
         source_annotation_key='b',
         filtering_annotation_key='a',
     )
     self.assertEqual(
         ''.join(s.get_content() for s in segmentation),
         'd',
         msg="intersect doesn't filter segments (annotation annotation)!"
     )
开发者ID:ArcaniteSolutions,项目名称:LTTL,代码行数:15,代码来源:test_segmenter.py


注:本文中的LTTL.Segmenter.intersect方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。