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


Python Segmenter.threshold方法代码示例

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


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

示例1: test_threshold_progress

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

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

        Segmenter.threshold(
            self.other_letter_seg,
            min_count=2,
            max_count=2,
            progress_callback=progress_callback,
        )
        self.assertEqual(
            self.count,
            len(self.other_letter_seg),
            msg="threshold doesn't track progress!"
        )
开发者ID:ArcaniteSolutions,项目名称:LTTL,代码行数:20,代码来源:test_segmenter.py

示例2: test_threshold_select_no_min_no_max

# 需要导入模块: from LTTL import Segmenter [as 别名]
# 或者: from LTTL.Segmenter import threshold [as 别名]
 def test_threshold_select_no_min_no_max(self):
     """Does threshold select segments (no min, no max)?"""
     segmentation, _ = Segmenter.threshold(
         self.other_letter_seg,
     )
     self.assertEqual(
         [s.get_content() for s in segmentation],
         ['a', 'b', 'b', 'c', 'c', 'c'],
         msg="threshold doesn't select segments (no min, no max)!"
     )
开发者ID:ArcaniteSolutions,项目名称:LTTL,代码行数:12,代码来源:test_segmenter.py

示例3: test_threshold_select

# 需要导入模块: from LTTL import Segmenter [as 别名]
# 或者: from LTTL.Segmenter import threshold [as 别名]
 def test_threshold_select(self):
     """Does threshold select segments (min and max)?"""
     segmentation, _ = Segmenter.threshold(
         self.other_letter_seg,
         min_count=2,
         max_count=2,
     )
     self.assertEqual(
         [s.get_content() for s in segmentation],
         ['b', 'b'],
         msg="threshold doesn't select segments (min and max)!"
     )
开发者ID:ArcaniteSolutions,项目名称:LTTL,代码行数:14,代码来源:test_segmenter.py

示例4: test_threshold_autonumber

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

示例5: test_threshold_copy_annotations_false

# 需要导入模块: from LTTL import Segmenter [as 别名]
# 或者: from LTTL.Segmenter import threshold [as 别名]
 def test_threshold_copy_annotations_false(self):
     """Does threshold skip copying annotations?"""
     segmentation, _ = Segmenter.threshold(
         self.other_letter_seg,
         min_count=2,
         max_count=2,
         copy_annotations=False,
     )
     self.assertEqual(
         [s for s in segmentation if 'a' in s.annotations],
         [],
         msg="threshold doesn't skip copying annotations!"
     )
开发者ID:ArcaniteSolutions,项目名称:LTTL,代码行数:15,代码来源:test_segmenter.py

示例6: test_threshold_copy_annotations

# 需要导入模块: from LTTL import Segmenter [as 别名]
# 或者: from LTTL.Segmenter import threshold [as 别名]
 def test_threshold_copy_annotations(self):
     """Does threshold copy annotations?"""
     segmentation, _ = Segmenter.threshold(
         self.other_letter_seg,
         min_count=2,
         max_count=2,
         copy_annotations=True,
     )
     self.assertEqual(
         [s.annotations['a'] for s in segmentation],
         ['1', '1'],
         msg="threshold doesn't copy annotations!"
     )
开发者ID:ArcaniteSolutions,项目名称:LTTL,代码行数:15,代码来源:test_segmenter.py

示例7: test_threshold_select_annotations

# 需要导入模块: from LTTL import Segmenter [as 别名]
# 或者: from LTTL.Segmenter import threshold [as 别名]
 def test_threshold_select_annotations(self):
     """Does threshold select segments using annotations?"""
     segmentation, _ = Segmenter.threshold(
         self.other_letter_seg,
         min_count=2,
         max_count=2,
         annotation_key='a',
     )
     self.assertEqual(
         [s.get_content() for s in segmentation],
         ['c', 'c'],
         msg="threshold doesn't select segments using annotations!"
     )
开发者ID:ArcaniteSolutions,项目名称:LTTL,代码行数:15,代码来源:test_segmenter.py


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