matcher.py 文件源码

python
阅读 27 收藏 0 点赞 0 评论 0

项目:text-matcher 作者: JonathanReeve 项目源码 文件源码
def get_initial_matches(self):
        """
        This does the main work of finding matching n-gram sequences between
        the texts.
        """
        sequence = SequenceMatcher(None,self.textAgrams,self.textBgrams)
        matchingBlocks = sequence.get_matching_blocks()

        # Only return the matching sequences that are higher than the
        # threshold given by the user.
        highMatchingBlocks = [match for match in matchingBlocks if match.size > self.threshold]

        numBlocks = len(highMatchingBlocks)

        if numBlocks > 0:
            print('%s total matches found.' % numBlocks, flush=True)

        return highMatchingBlocks
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号