post_reader.py 文件源码

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

项目:auto-aggregator 作者: milindl 项目源码 文件源码
def best_scoring_value(self, groups):
        '''
        Finds best fuzzy match
        Compares each elem of the group with each keyphrase/word in loc_map
        Returns the location with best matching
        '''
        best_match = ''
        best_score = 0
        groups = list(groups)
        # Append the whole of the group to the things to be checked
        # For instance, for the group ('a', 'b'), 'a b' will also be matched
        groups.append(' '.join(groups))
        for g in groups:
            for key in self.loc_map:
                if fuzz.ratio(key, g) > best_score:
                    best_score = fuzz.ratio(key, g)
                    best_match = self.loc_map[key]
        return best_match
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号